我正在使用 Exchange 2010 EWS托管API 并尝试更新电子邮件(EmailMessage
)。
在更新EmailMessage's Sender.Name
属性时,我会在Update()
上收到异常,但如果我尝试更新EmailMessage's Subject
,则可以正常使用。
private void UpdateEmail(ItemId itemId)
{
try
{
EmailMessage emailMessage = EmailMessage.Bind(service, itemId, new PropertySet(EmailMessageSchema.Sender, EmailMessageSchema.Subject));
// Test 1 - this works:
emailMessage.Subject = "Testing";
emailMessage.Update(ConflictResolutionMode.AlwaysOverwrite);
// Test 2 - this does NOT work (if I comment out the previous 2 lines btw):
emailMessage.Sender.Name = "John Smith";
emailMessage.Update(ConflictResolutionMode.AlwaysOverwrite); // exception thrown
...
我从测试2中得到以下错误:
The request failed schema validation: The element 'Updates' in namespace 'http:/
/schemas.microsoft.com/exchange/services/2006/types' has incomplete content. Lis
t of possible elements expected: 'AppendToItemField, SetItemField, DeleteItemFie
ld' in namespace 'http://schemas.microsoft.com/exchange/services/2006/types'.
答案 0 :(得分:1)
EWS不支持通过您尝试的强类型属性更改发件人地址。他们可能成功的唯一方法是修改底层扩展属性并生成oneoff或wrapped entry-id,在适用的情况下需要更新的道具
PR_SENDER_ADDRTYPE_W
PR_SENDER_EMAIL_ADDRESS_W
PR_SENDER_NAME_W
PR_SENDER_ENTRYID
PR_SENDER_SEARCH_KEY
PR_SENT_REPRESENTING_EMAIL_ADDRESS_W
PR_SENT_REPRESENTING_ADDRTYPE_W
PR_SENT_REPRESENTING_NAME_W
PR_SENT_REPRESENTING_ENTRYID
PR_SENT_REPRESENTING_SEARCH_KEY
请注意,也许其他人也需要使用像MFCMapi的OutlookSpy这样的MAPI编辑器来自己查看项目。
干杯 格伦