【发布时间】:2016-11-23 19:27:00
【问题描述】:
我正在尝试使用 EWS 将电子邮件从委托收件箱移动到委托文件夹。
首先,我获取委托inbox 中的所有文件夹以获取Id 和ChangeKey 属性(代替依赖名称)
<FindFolder Traversal='Shallow' xmlns='http://schemas.microsoft.com/exchange/services/2006/messages'>
<FolderShape>
<t:BaseShape>Default</t:BaseShape>
</FolderShape>
<ParentFolderIds>
<t:DistinguishedFolderId Id='inbox'>
<t:Mailbox>
<t:EmailAddress>delegate.name@email.com</t:EmailAddress>
</t:Mailbox>
</t:DistinguishedFolderId>
</ParentFolderIds>
</FindFolder>
接下来,我使用上面找到的文件夹的inbox 和Id 和ChangeKey 中的电子邮件的Id 和ChangeKey 来尝试移动
<m:MoveItem>
<m:ToFolderId>
<FolderId Id='folder.Id' ChangeKey='folder.ChangeKey'>
<t:Mailbox>
<t:EmailAddress>delegate.name@email.com</t:EmailAddress>
</t:Mailbox>
</FolderId>
</m:ToFolderId>
<m:ItemIds>
<t:ItemId Id='email.Id' ChangeKey='email.ChangeKey' />
</m:ItemIds>
</m:MoveItem>
对我来说这可行,但在查看文档后,<FolderId> 元素不允许<t:Mailbox> 子元素。
<t:DistinguishedFolderId> 确实允许<t:Mailbox>,但我只能从先前识别的文件夹列表中选择,而不是用户定义的文件夹。有没有办法告诉<MoveItem> 调用所有这些操作都发生在代理电子邮件上?
更新(工作):
<MoveItem xmlns='http://schemas.microsoft.com/exchange/services/2006/messages' xmlns:t='http://schemas.microsoft.com/exchange/services/2006/types'>
<ToFolderId>
<t:FolderId Id='folder.Id' ChangeKey='folder.ChangeKey' />
</ToFolderId>
<ItemIds>
<t:ItemId Id='item.Id' ChangeKey='item.ChangeKey' />
</ItemIds>
</MoveItem>
【问题讨论】:
标签: email delegates exchangewebservices