Office365 通过api获取Office 365帐户的用户列表
我已设置Office 365业务帐户。如何通过API访问我已添加到帐户中的用户列表 这是我需要获取的帐户和用户列表的屏幕截图-Office365 通过api获取Office 365帐户的用户列表,office365,azure-active-directory,office365api,Office365,Azure Active Directory,Office365api,我已设置Office 365业务帐户。如何通过API访问我已添加到帐户中的用户列表 这是我需要获取的帐户和用户列表的屏幕截图- 实际上,我需要获得此用户列表以及每个用户的角色(全局管理员、用户(无管理员访问权限))的信息。Office 365 API功能也可以通过(推荐)获得,这是一个统一的API,包括来自其他Microsoft服务的API 使用Microsoft Graph api,您可以通过: 您可以使用获取用户是其直接成员的组和目录角色: GET /users/{id | userPrin
实际上,我需要获得此用户列表以及每个用户的角色(全局管理员、用户(无管理员访问权限))的信息。Office 365 API功能也可以通过(推荐)获得,这是一个统一的API,包括来自其他Microsoft服务的API 使用Microsoft Graph api,您可以通过: 您可以使用获取用户是其直接成员的组和目录角色:
GET /users/{id | userPrincipalName}/memberOf
以下是结果供您参考:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects",
"value": [
{
"@odata.type": "#microsoft.graph.directoryRole",
"id": "bee946b1-bf9c-4d97-bdb6-41931e37e677",
"deletedDateTime": null,
"description": "Company Administrator role has full access to perform any operation in the company scope.",
"displayName": "Company Administrator",
"roleTemplateId": "62e90394-69f5-4237-9190-012177145e10"
},
{
"@odata.type": "#microsoft.graph.group",
"id": "e1b32e43-dab2-49e1-a2f3-51e391888a44",
"deletedDateTime": null,
"classification": null,
"createdDateTime": "2017-04-06T08:15:54Z",
"description": "MySite",
"displayName": "MySite",
"groupTypes": [
"Unified"
],
"mail": "MySite@chencl.onmicrosoft.com",
"mailEnabled": true,
"mailNickname": "MySite",
"onPremisesLastSyncDateTime": null,
"onPremisesProvisioningErrors": [],
"onPremisesSecurityIdentifier": null,
"onPremisesSyncEnabled": null,
"proxyAddresses": [
"SMTP:MySite@chencl.onmicrosoft.com"
],
"renewedDateTime": "2017-04-06T08:15:54Z",
"securityEnabled": false,
"visibility": "Public"
}
]
}
您可以通过过滤
@odata.type
为#microsoft.graph.directoryRole
的结果来获得。您可以检查管理员角色。如果用户没有管理员访问权限(user),则不存在具有上述RESTAPI的directoryRole
值。有关如何获取访问令牌以调用Microsoft Graph,您可以单击以获取更多详细信息。Office 365 API功能也可通过(推荐)获得,这是一种统一的API,包括来自其他Microsoft服务的API
使用Microsoft Graph api,您可以通过:
您可以使用获取用户是其直接成员的组和目录角色:
GET /users/{id | userPrincipalName}/memberOf
以下是结果供您参考:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects",
"value": [
{
"@odata.type": "#microsoft.graph.directoryRole",
"id": "bee946b1-bf9c-4d97-bdb6-41931e37e677",
"deletedDateTime": null,
"description": "Company Administrator role has full access to perform any operation in the company scope.",
"displayName": "Company Administrator",
"roleTemplateId": "62e90394-69f5-4237-9190-012177145e10"
},
{
"@odata.type": "#microsoft.graph.group",
"id": "e1b32e43-dab2-49e1-a2f3-51e391888a44",
"deletedDateTime": null,
"classification": null,
"createdDateTime": "2017-04-06T08:15:54Z",
"description": "MySite",
"displayName": "MySite",
"groupTypes": [
"Unified"
],
"mail": "MySite@chencl.onmicrosoft.com",
"mailEnabled": true,
"mailNickname": "MySite",
"onPremisesLastSyncDateTime": null,
"onPremisesProvisioningErrors": [],
"onPremisesSecurityIdentifier": null,
"onPremisesSyncEnabled": null,
"proxyAddresses": [
"SMTP:MySite@chencl.onmicrosoft.com"
],
"renewedDateTime": "2017-04-06T08:15:54Z",
"securityEnabled": false,
"visibility": "Public"
}
]
}
您可以通过过滤@odata.type
为#microsoft.graph.directoryRole
的结果来获得。您可以检查管理员角色。如果用户没有管理员访问权限(user),则不存在具有上述RESTAPI的directoryRole
值。有关如何获取访问令牌以调用Microsoft Graph,您可以单击以获取更多详细信息