Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI
Below i am sending the code that i am using to fetch the emails from other mailbox in EWS but i am getting an error called 'Object not found in the store' at 'Folder inbox = Folder.Bind(service, fid); ' line, can any one find me the best solution, i am struggling with it for the past one month

class Program
{
static void Main(string[] args)
{
Console.WriteLine("started");
var service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
service.Credentials = new WebCredentials("Serveraccount", "Serviceaccountpwd", "domain");
service.AutodiscoverUrl("targetmailbox");
service.Url = new Uri("serviceuri");
service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "targetmailbox");
Console.WriteLine("connected");
Mailbox mb = new Mailbox("targetmailbox");
FolderId fid = new FolderId(WellKnownFolderName.Inbox, mb);
Folder inbox = Folder.Bind(service, fid);
if (inbox != null)
{
FindItemsResults<item> items = inbox.FindItems(new ItemView(100));
foreach (var item in items)
Console.WriteLine(item.Subject);
}
Console.ReadLine();
}
}

What I have tried:

i searched Google,tried Independentsoft, aspose, eagetmail but my efforts were not fruitful.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900