【问题标题】:Accessing other user calendar using service account使用服务帐户访问其他用户日历
【发布时间】:2014-12-23 10:29:52
【问题描述】:

我们正在尝试使用 EWS 托管 API 集成 Office 365。我们使用 office 365 管理中心创建了一个具有模拟角色的服务帐户。 现在,我们如何使用该服务帐户来访问应用程序中其他用户的数据(如邮件、联系人、日历)? 谢谢,罗希特

【问题讨论】:

    标签: c# ms-office exchangewebservices office365


    【解决方案1】:

    您像往常一样创建一个 ExchangeService 实例,然后设置其 ImpersonatedUserId。

    示例:

    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");
    

    在此之后,您可以访问其他用户(在本例中为 calendaruser)的数据。

    【讨论】:

    • 谢谢。只是另一个查询,我们可以使用模拟用户 ID 和 OAuth 来生成客户端 ID、访问令牌等吗?
    • 它给了我错误,因为日历用户的“SMTP 地址没有与之关联的邮箱”?为什么会出现这个错误??
    【解决方案2】:

    http://msdn.microsoft.com/en-us/library/office/dn722377(v=exchg.150).aspx 及其所有子主题都是一个不错的起点。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多