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.