[英]How to access a email by id or guid after move to another folder via exchange webservices
I have a this public folder structure: 我有一个公用文件夹结构:
Test\Incoming
Test\Read
I use the following code with Microsoft.Exchange.WebServices Version 2.2
: 我将以下代码与
Microsoft.Exchange.WebServices Version 2.2
:
//Get Email
EmailMessage mailItem = EmailMessage.Bind(service, ItemID, new PropertySet(BasePropertySet.FirstClassProperties));
//Get UniqueId "FirstID"
mailItem.Id.UniqueId
//Move Email to Incoming\Read
mailItem.Move(destinationFolderID);
//After moving the UniqueId changed to "ChangedID"
mailItem.Id.UniqueId
Is there a way to access the moved email by id/guid because the UniqueId isn't constant 是否可以通过id / guid访问移动的电子邮件,因为UniqueId不是恒定的
It depends where the move is taking place eg if your moving to another folder within the same Mailbox (in the case of Public Folders it may depend where you have multiple public folder mailboxes and those folders are on different Mailboxes) then the Move Method will return the the new Id of the Item so 它取决于移动的位置,例如,如果您移动到同一邮箱中的另一个文件夹(对于公用文件夹,则可能取决于您在多个邮箱中的位置,而这些文件夹位于不同的邮箱中),则移动方法将返回项目的新ID
//Move Email to Incoming\Read
NewItem = mailItem.Move(destinationFolderID);
//After moving the UniqueId changed to "ChangedID"
NewItem.Id.UniqueId
If your moving it to a folder in another Mailbox then the MoveItem operation won't return the newid and you will need to search for the Item in the new folder using something like the SearchKey or other custom property you set 如果将其移动到另一个邮箱中的文件夹中,则MoveItem操作将不会返回新ID,并且您将需要使用诸如SearchKey或您设置的其他自定义属性在新文件夹中搜索Item
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.