Office 365 비즈니스 계정을 설정했는데 API를 통해 내 계정에 추가 한 사용자 목록에 액세스하려면 어떻게하나요?
다음은 가져와야하는 내 계정 및 사용자 목록의 스크린 샷입니다 . https://www.screencast.com/t/Bq1M3qegUQt .
실제로 각 사용자의 역할 (글로벌 관리자, 사용자 (관리자 권한 없음))과 함께이 사용자 목록을 가져와야합니다.
Office 365 API 기능은 다른 Microsoft 서비스의 API를 포함하는 통합 API 인 Microsoft Graph (권장) 를 통해서도 사용할 수 있습니다 .
Microsoft Graph api를 사용하면 다음을 통해 사용자 를 나열 할 수 있습니다 .
GET https://graph.microsoft.com/v1.0/users
List memberOf 를 사용 하여 사용자가 직접 구성원 인 그룹 및 디렉터리 역할을 가져올 수 있습니다 .
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": "[email protected]",
"mailEnabled": true,
"mailNickname": "MySite",
"onPremisesLastSyncDateTime": null,
"onPremisesProvisioningErrors": [],
"onPremisesSecurityIdentifier": null,
"onPremisesSyncEnabled": null,
"proxyAddresses": [
"SMTP:[email protected]"
],
"renewedDateTime": "2017-04-06T08:15:54Z",
"securityEnabled": false,
"visibility": "Public"
}
]
}
당신이 얻을 수있는 역할을 결과를 필터링하여 @odata.type
입니다 #microsoft.graph.directoryRole
. 여기 에서 관리자 역할을 확인할 수 있습니다 . 사용자에게 admin access (User)가 없으면 directoryRole
위의 rest api 값 이 없습니다 . Microsoft Graph를 호출하는 액세스 토큰을 얻는 방법은 여기 를 클릭 하여 자세한 내용을 확인할 수 있습니다 .
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다