EWS Search Calendar with Service Account
I'm using the following code to return items from the calendar. When I
connect with the user's actual credentials, I get 10 items back, as
expected. When I connect as the service account, I always get 0. The
service account has the right privileges to view and update the user's
calendar. Why isn't it returning any results?
// Connect to Exchange Web Services
service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
--> service.Credentials = new WebCredentials("svc_user",
"svc_password", "domain");
--> //service.Credentials = new WebCredentials("user",
"password", "domain");
service.AutodiscoverUrl("user@domain");
//Return count
ItemView view = new ItemView(10);
view.PropertySet = new PropertySet(BasePropertySet.IdOnly);
FindItemsResults<Item> findResults =
service.FindItems(WellKnownFolderName.Calendar, view);
MessageBox.Show(findResults.Count().ToString());
No comments:
Post a Comment