首页 文章

作为Office 365管理员,我可以订阅其他365用户事件的事件吗?

提问于
浏览
0

作为Office 365管理员,我可以订阅在微软图上监听其他365个用户事件的事件吗?我可以为我举办活动https://graph.microsoft.com/v1.0/me/events或"/v1.0/users/Admin@tenant.onmicrosoft.com/events" --Works很好......但是当管理员试图获取其他用户的活动详情时 . 我收到错误
"message":"Access is denied. Check credentials and try again.",https://graph.microsoft.com/v1.0/users/ABC@tenant.onmicrosoft.com

是否可以获取其他用户的事件详细信息?如果是,那么请告诉我管理员方面缺少的任何设置 . 如果不是那么api与“/v1.0/users/”和“/v1.0/me/”之间的区别是什么?

2 回答

  • 0

    是 . 您可以使用 Client Credential flow 获取应用程序的应用程序令牌 . 请确保您注册的应用程序具有 Calendars.Read 范围,以读取所有邮箱中的日历,如下图所示:

    enter image description here

    有关详细信息,请参阅here .

    仅限应用令牌的代码请求:

    public static async Task<string> GetTokenAsync(string resource, string clientId, string secrect)
        {
            string authority = "https://login.microsoftonline.com/{yourtenant}";
            AuthenticationContext authContext = new AuthenticationContext(authority);
    
            ClientCredential clientCredential = new ClientCredential(clientId, secrect);
            AuthenticationResult authResult=await authContext.AcquireTokenAsync(resource, clientCredential);
            return authResult.AccessToken;
        }
    
      public static void GetAccessTokenByClientCredential()
        {
            string clientId = "";
            string secrect = "";
            string resrouce = "https://graph.microsoft.com";
            string accessToken= TokenHelper.GetTokenAsync(resrouce, clientId, secrect).Result;
            Console.WriteLine($"Access Token: {accessToken}");
    
        }
    
  • 1

    根据微软家伙使用/ events endpoints 查看另一个用户的日历,你需要一个特殊的权限(类似Calendar.Read.Shared),我们仍然在添加,请看下面的链接..

    Microsoft Graph api 403 access denied when reading other users

    这个帖子发表于4月21日Venkat Ayyadevara - MSFT,我猜仍在进行中 .

相关问题