Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

EWS Managed API - Updating message fails from account that does not have a mailbox

$
0
0

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.

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.

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.

Here’s some sample code:

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 AsNew Mailbox("test@mydomain.com")Dim InboxFolderID AsNew 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)

EndTry

If I run this code using the credentials of the mailbox I am working in it updates OK. If I run it using a different account that has full permission it throws the exception.


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>