Working with shared/other mailboxes

0 votes
asked Jul 28, 2016 by Manuel.W (180 points)

Hello,
i want to work with shared or other mailboxes with one login user by using Rebex.Ews.

The login user is a user with impersonation privilige and has access to mailboxes which are in one active directory group.

I am using a code similar to the sharedmailbox sample to to get the folderId of the other mailbox

folderId = new EwsFolderId(EwsSpecialFolder.Inbox, sSharedMailbox);

When I want to list the message of a other mailbox I get a list with a count of 0.
If I login with a 'normal' user and I want to access to a other mailbox, I get the messages of the loggedin user.

It seems that to access to a other/shared mailbox does not working.

Thanks for your help.

Applies to: Rebex Secure Mail
commented Jul 28, 2016 by Manuel.W (180 points)
I solved the error, I used EwsFolderId instead of EwsSpecialFolder in the constructor of EwsFolderId.

But I now get a different error if I want to access the folder I get a ErrorItemNotFound exception

1 Answer

0 votes
answered Jul 28, 2016 by Pavel Matyska (9,640 points)

Hello,

your previous code was correct. To access a folder in other mailbox, use that constructor:

new EwsFolderId(EwsSpecialFolder.Inbox, sSharedMailbox)

You can see in a Debug log, whether the request is targeting your shared mailbox or not. You can create a log as described at https://www.rebex.net/kb/logging/.

Ews.GetMessageList results in FindItem SOAP request
(you can see it under this line:

Invoking 'FindItem' action

and see whether DistinguishedFolderId element has Mailbox childe element with correct value or not. Few lines later you can see the response.

If an error occured on the server (like you wrote in your comment), the response looks very similar to this

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo ... />
</s:Header>
<s:Body ... >
<m:FindItemResponse ... >
<m:ResponseMessages>
<m:FindItemResponseMessage ResponseClass="Error">
<m:MessageText>The specified object was not found in the store.</m:MessageText>
<m:ResponseCode>ErrorItemNotFound</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
</m:FindItemResponseMessage>
</m:ResponseMessages>
</m:FindItemResponse>
</s:Body>
</s:Envelope>

If you cannot locate the request and response in the log, please send it back to us at support@rebex.net for analysis. For now, I can only tell that the user have not sufficient rights to see emails in that other mailbox.

...