简体   繁体   English

通过Exchange Web服务移动到另一个文件夹后如何通过ID或GUID访问电子邮件

[英]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.

相关问题 C# MS Exchange 将电子邮件移至文件夹 - C# MS Exchange Move Email To Folder C# 如何从 C# 控制台应用程序以编程方式访问共享 Outlook/Exchange 邮箱以将电子邮件从收件箱移动到另一个文件夹 - C# How to access a shared outlook/exchange mailbox programmatically from a C# console application to move emails from inbox to another folder 如何通过WebDav访问Exchange 2007公用文件夹? - How to access an Exchange 2007 public folder via WebDav? 如何通过 Microsoft.Exchange.WebServices 获取 GAL id 并使用 FindPeople - How to get GAL id and use FindPeople with use of Microsoft.Exchange.WebServices 使用Sharepoint Web服务获取自定义字段的ID / GUID - Using Sharepoint webservices to get the ID/GUID of a custom field 通过电子邮件接收附件并自动将其移动到预定义的文件夹 - Receive attachment via email and automatically move it to a pre defined folder 如何使用 Microsoft.Exchange.WebServices? - How to use Microsoft.Exchange.WebServices? c#Exchange Webservices删除公用文件夹中的约会 - c# Exchange Webservices delete appointment in public folder 如何在不使用smtp的情况下通过Exchange服务器发送电子邮件? - How to send email via exchange server without using smtp? Microsoft.Exchange.WebServices.Data.ServiceResponseException:无法访问帐户或邮箱 - Microsoft.Exchange.WebServices.Data.ServiceResponseException: Unable to access an account or mailbox
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM