Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure active directory 为什么graphClient.Me.Request().GetAsync()会为某些非空的AAD配置文件字段返回空值?_Azure Active Directory_Azure Mobile Services_Microsoft Graph Api - Fatal编程技术网

Azure active directory 为什么graphClient.Me.Request().GetAsync()会为某些非空的AAD配置文件字段返回空值?

Azure active directory 为什么graphClient.Me.Request().GetAsync()会为某些非空的AAD配置文件字段返回空值?,azure-active-directory,azure-mobile-services,microsoft-graph-api,Azure Active Directory,Azure Mobile Services,Microsoft Graph Api,我正在使用Graph API从UWP应用程序访问用户信息。我将Azure应用程序服务与客户端UWP应用程序和Azure后端一起使用 我的Azure Active Directory只有我和一个测试用户。我的应用程序中的以下行确实从AAD返回了我的一些信息: Microsoft.Graph.GraphServiceClient graphClient = new Microsoft.Graph.GraphServiceClient(new DelegateAuthenticatio

我正在使用Graph API从UWP应用程序访问用户信息。我将Azure应用程序服务与客户端UWP应用程序和Azure后端一起使用

我的Azure Active Directory只有我和一个测试用户。我的应用程序中的以下行确实从AAD返回了我的一些信息:

Microsoft.Graph.GraphServiceClient graphClient =
        new Microsoft.Graph.GraphServiceClient(new DelegateAuthenticationProvider((requestMessage) =>
{
       requestMessage.Headers.Authorization =
           new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", result2.AccessToken);
       return Task.FromResult(0);
}));

Microsoft.Graph.User user = await graphClient.Me.Request().GetAsync();
但是,当我在调用后检查用户变量的内容时,除了DisplayName、GivenName、ID、JobTitle、AdditionalItems和userPrincipalName之外,所有字段都列为null。不为null的值是正确的。但是,我也填写了所有街道地址字段,并在AAD上为我的个人资料提供了个人资料图片。但这些也都是无效的。谁能告诉我这是什么原因吗?我检查了与请求一起发送的访问令牌,它似乎包含了所需的权限。为了确保这一点,当我在AAD中注册我的应用程序时,我请求了Windows Azure广告和Microsoft Graph所需的所有代理权限


谢谢。

Microsoft图形在每个响应中返回一组默认的核心属性。可以使用$select查询参数获取其他属性

例如,获取https://graph.microsoft.com/v1.0/me/ 不返回用户的streetAddress字段,但获取https://graph.microsoft.com/v1.0/me/?$select=streetaddress返回它。您可以通过使用逗号分隔字段(如$select=id、jobTitle、streetAddress)来获取多个属性


对于.NET SDK,我相信语法是Request.SelectassignedLicenses.GetAsync和。

谢谢!这适用于除个人资料图片以外的所有内容。我还在想办法解决这个问题。