Accessing other user calendar using service account

大城市里の小女人 提交于 2020-01-03 05:25:09

问题


We are trying to integrate office 365 using EWS managed API's. We have created one service account with impersonation role using office 365 admin center. Now, how can we use that service account to access other user's data(like mails, contacts, calendar) in the application ? Thanks, Rohit


回答1:


You create an instance of ExchangeService as usual and then set its ImpersonatedUserId.

Sample:

var credentials = new WebCredentials(
    "impersonateduser@your.onmicrosoft.com", "password", "");

var exchange = new ExchangeService{PreAuthenticate=true, Credentials=credentials};
exchange.ImpersonatedUserId = new ImpersonatedUserId(
    ConnectingIdType.SmtpAddress, 
    "calendaruser@your.onmicrosoft.com");

After this you can access the other user's (in this case calendaruser) data.




回答2:


http://msdn.microsoft.com/en-us/library/office/dn722377(v=exchg.150).aspx and all of its sub-topics is a good place to start.



来源:https://stackoverflow.com/questions/27618515/accessing-other-user-calendar-using-service-account

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!