views:

31

answers:

0

I am trying to access a mailbox and I already gave permissions to the user as can be seen in the next image.

http://img46.imageshack.us/img46/5692/setou.jpg

1-> is the email I want to check

2-> is the user that has permissions

and when I run this code to get the inbox emails

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);

service.Credentials = new NetworkCredential("user", "passsword", "domain");

service.Url = new Uri("https://url/EWS/Exchange.asmx");

Mailbox mb = new Mailbox("email");
FolderId fid1 = new FolderId(WellKnownFolderName.Inbox, mb);

//reads the emails
FindItemsResults<Item> findResults = service.FindItems(fid1, new ItemView(50));

ssErrors += "entrou";
foreach (Item item in findResults.Items)
{
 item.Load();
 EmailMessage m = (EmailMessage)item;
 //if (!m.IsRead)
 //{
 // //Colocar como lida.
 // m.IsRead = true;
 // m.Update(ConflictResolutionMode.AutoResolve);
 //}
}

but if I run this code I get this: The error is: The specified object was not found in the store.

What is wrong? Why I can access to that inbox account?