EWS托管API - 从没有邮箱的帐户更新邮件失败 [英] EWS Managed API - Updating message fails from account that does not have a mailbox

查看:133
本文介绍了EWS托管API - 从没有邮箱的帐户更新邮件失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在搜索这个问题的答案,但却找不到任何答案。我已经看过描述类似问题的帖子,但我没有看到任何答案的答案。

I’ve been searching for hours for an answer to this problem but can’t find anything. I’ve seen posts that describe a similar problem but I’ve not seen any replies with an answer.

我正在编写一个使用EWS托管API来处理抵达邮箱的电子邮件的应用程序在交换服务器上。它使用具有完全权限的单个帐户设置为连接到每个邮箱,以便它可以处理邮件。当我阅读消息
内容,打开附件,移动消息,删除消息&在邮箱中创建文件夹,但我无法更新邮件。

I’m writing an app that uses EWS Managed API to process emails arriving in mailboxes on an exchange server. It uses a single account with full permissions set to connect to each mailbox so it can process messages. It works fine when I read message content, open attachments, move messages, delete messages & create folders in the mailbox but I can’t get it to update a message.

如果我拨打"更新"字样。消息上的方法我收到此异常:
$
当作为没有邮箱的帐户发出请求时,必须为任何可识别的文件夹ID指定邮箱主SMTP地址。

If I call the “update” method on a message I get this exception:
When making a request as an account that does not have a mailbox, you must specify the mailbox primary SMTP address for any distinguished folder Ids.

我无法找到关于我应该如何进行此更新的任何文档。

I can’t find any documentation on how I’m supposed to do this update.

这里有一些示例代码:


ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf ValidateCertificate)

m_Service = New ExchangeService(ExchangeVersion.Exchange2007_SP1)

m_Service.Credentials = New WebCredentials("serviceaccount", "servicepassword", "mydomain")

m_Service.AutodiscoverUrl("test@mydomain.com")

Dim MyMailBox As New Mailbox("test@mydomain.com")

Dim InboxFolderID As New FolderId(WellKnownFolderName.Inbox, MyMailBox)

Dim MessageList As FindItemsResults(Of Item) = m_Service.FindItems(InboxFolderID, New ItemView(1))

Dim msg As Item = MessageList.Items(0)

Try

 msg.Subject = "My test at " & Now.ToShortTimeString

 msg.Update(ConflictResolutionMode.AutoResolve)

Catch ex As Exception

 Debug.Print(ex.Message)

End Try

推荐答案

我没有得到任何答案。

 

我认为异常消息说它需要一个主电子邮件地址所以我想我会尝试在我用于凭据的帐户中添加一个Exchange电子邮箱。 
一旦我这样做就行了!

I figured the exception message said it needed a primary email address so I thought I'd try adding an Exchange email box to the account I was using for credentials.  As soon as I did that it worked!

 

即使该帐户拥有对邮箱的完全访问权限,您似乎也无法移动除非您用于凭据的帐户具有
a主电子邮件地址。  不要问我为什么!无论如何,永远不会使用电子邮件帐户,但凭据现在可以使用EWS API。

Even though the account had full access rights to the mailboxes it seems you can’t move a message unless the account you are using for credentials has a primary email address.  Don’t ask me why! Anyway the email account will never be used but the credentials now work with the EWS API.


这篇关于EWS托管API - 从没有邮箱的帐户更新邮件失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆