Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/292.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
C#查找用户是否已从Windows Server AD迁移到Microsoft Azure_C#_.net Core_Uwp_Microsoft Graph Api_Microsoft Graph Sdks - Fatal编程技术网

C#查找用户是否已从Windows Server AD迁移到Microsoft Azure

C#查找用户是否已从Windows Server AD迁移到Microsoft Azure,c#,.net-core,uwp,microsoft-graph-api,microsoft-graph-sdks,C#,.net Core,Uwp,Microsoft Graph Api,Microsoft Graph Sdks,在我的个人Azure帐户中,我从Windows Server广告迁移了一些用户,有些用户直接在Azure广告中创建,有些用户来自Microsoft个人帐户。我已经能够在Windows桌面应用程序中使用显示这些用户-类似于我们在Azure Portal中看到的(如下所示)。此外,如下所示,Azure portal中用户列表的源会告诉您用户是否从Windows Server AD迁移。但是,我无法找到一种方法,通过编程确定用户是否从Windows Server AD迁移问题:是否有MS Graph

在我的个人Azure帐户中,我从
Windows Server广告
迁移了一些用户,有些用户直接在
Azure广告
中创建,有些用户来自Microsoft个人帐户。我已经能够在Windows桌面应用程序中使用显示这些用户-类似于我们在Azure Portal中看到的(如下所示)。此外,如下所示,Azure portal中用户列表的
会告诉您用户是否从Windows Server AD迁移。但是,我无法找到一种方法,通过编程确定用户是否从Windows Server AD迁移问题:是否有MS Graph API或其他方式以编程方式查明用户是否从Windows Server AD迁移

备注:虽然我使用的是UWP,但这不重要。建议可以与任何类型的应用程序相关,只要语言是C#

获取用户列表

// Get the Graph client from the provider
var graphClient = ProviderManager.Instance.GlobalProvider.Graph;

 var users = await graphClient.Users.Request()
    .Select("displayName, userPrincipalName, userType")
     .GetAsync();
Azure Portal中显示的用户[对于我的Windows桌面应用程序中的
源列
,我需要确定用户是否从Windows Server AD迁移]:


我认为您可以通过以
内部部署开始的字段来区分用户与(或不与)Windows Server广告。如果用户来自Windows Server AD,则字段
onPremises…
将不为空。如果不是来自Windows Server AD,则字段应为空。请参阅以下截图:

=================================================更新==================================


我们可以使用上面显示的其中一个字段(例如
OnPremisesUserPrincipalName
)来判断用户是否来自Windows Server AD。

中有26个这样的字段。我认为在一个标准中使用这些太多了。根据我的需要,只需使用
OnPremisesUserPrincipalName
字段就足够了。然而,我没有得到预期的结果。如果您有任何建议/意见,我已发布该问题。发布的问题现已解决。如果您可以根据我的需要修改您的上述回复(如我在上面的评论中所述),我也会将您的上述回复标记为
答案
,这样其他用户也可以从中受益。如果一个回答是被接受的,读者会更加关注它。谢谢。嗨@nam,我已经改进了我的答案。