MoveItemType Class
The MoveItemType class represents an operation to move items in a mailbox.
Namespace: ExchangeWebServices
Assembly: EWS (in ews.dll)
Syntax
'Declaration
<SerializableAttribute> _
<DebuggerStepThroughAttribute> _
<XmlTypeAttribute(Namespace:="https://schemas.microsoft.com/exchange/services/2006/messages")> _
<GeneratedCodeAttribute("wsdl", "2.0.50727.42")> _
<DesignerCategoryAttribute("code")> _
Public Class MoveItemType
Inherits BaseMoveCopyItemType
[SerializableAttribute]
[DebuggerStepThroughAttribute]
[XmlTypeAttribute(Namespace="https://schemas.microsoft.com/exchange/services/2006/messages")]
[GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[DesignerCategoryAttribute("code")]
public class MoveItemType : BaseMoveCopyItemType
[SerializableAttribute]
[DebuggerStepThroughAttribute]
[XmlTypeAttribute(Namespace=L"https://schemas.microsoft.com/exchange/services/2006/messages")]
[GeneratedCodeAttribute(L"wsdl", L"2.0.50727.42")]
[DesignerCategoryAttribute(L"code")]
public ref class MoveItemType : public BaseMoveCopyItemType
/** @attribute SerializableAttribute() */
/** @attribute DebuggerStepThroughAttribute() */
/** @attribute XmlTypeAttribute(Namespace="https://schemas.microsoft.com/exchange/services/2006/messages") */
/** @attribute GeneratedCodeAttribute("wsdl", "2.0.50727.42") */
/** @attribute DesignerCategoryAttribute("code") */
public class MoveItemType extends BaseMoveCopyItemType
SerializableAttribute
DebuggerStepThroughAttribute
XmlTypeAttribute(Namespace="https://schemas.microsoft.com/exchange/services/2006/messages")
GeneratedCodeAttribute("wsdl", "2.0.50727.42")
DesignerCategoryAttribute("code")
public class MoveItemType extends BaseMoveCopyItemType
Remarks
Starting with Exchange Server 2007 Service Pack (SP1) with Update Rollup 4 (RU4) applied, the item identifier of the new item is returned in the response message (MoveItemResponseType). Item identifiers are not returned in responses for cross-mailbox or mailbox to public folder MoveItem operations.
Inheritance Hierarchy
System.Object
ExchangeWebServices.BaseRequestType
ExchangeWebServices.BaseMoveCopyItemType
ExchangeWebServices.MoveItemType
Example
The following example shows how to move two items to the Deleted Items default folder.
static void MoveItem(ExchangeServiceBinding esb)
{
// Identify the items to move.
ItemIdType item1 = new ItemIdType();
ItemIdType item2 = new ItemIdType();
item1.Id = "AAAlAE1";
item2.Id = "AAAlAE2";
ItemIdType[] items = new ItemIdType[2] { item1, item2 };
// Identify the destination folder.
DistinguishedFolderIdType destFolder = new DistinguishedFolderIdType();
destFolder.Id = DistinguishedFolderIdNameType.deleteditems;
// Form the move request.
MoveItemType request = new MoveItemType();
request.ItemIds = items;
request.ToFolderId = new TargetFolderIdType();
request.ToFolderId.Item = destFolder;
try
{
// Send the request and get the response.
MoveItemResponseType response = esb.MoveItem(request);
ArrayOfResponseMessagesType aormt = response.ResponseMessages;
ResponseMessageType[] rmta = aormt.Items;
foreach (ResponseMessageType rmt in rmta)
{
if (rmt.ResponseClass == ResponseClassType.Error)
{
throw new Exception("Item move failed.");
}
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms
Development Platforms
Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003,
Target Platforms
Windows 98, Windows 2000, Windows 2000 Server, Windows CE, Windows Longhorn, Windows 98 Second Edition, Pocket PC, Smart Phone, Windows Server 2003, Windows XP Professional with Service Pack 2 (SP2)
See Also
Reference
MoveItemType Members
ExchangeWebServices Namespace
Other Resources
MoveItem Operation
Setting Up the ExchangeServiceBinding Proxy Class