我已经在Azure中注册了应用程序。我https://graph.microsoft.com/v1.0/users
获取用户信息。
是否可以获取有关用户的所有信息?看看我可以在JSON响应中得到什么数据?
现在,当我使用https://graph.microsoft.com/v1.0/users时,只会得到一些信息,例如:
{
"aio": "kjaldjsfhkjsadhflkdhsafkjadhsfa",
"amr": "[\"pwd\"]",
"family_name": "Picasso",
"given_name": "Pablo",
"ipaddr": "11.12.113.144",
"name": "Pablo Picasso",
"oid": "234234-2343-4343-43434-2342342",
"onprem_sid": "234234234-23-423-4-234-2-34-234",
"sub": "234233q45rtferfwverfwgw45grfg45g45",
"tid": "sdfkjgasdhjfgasjdhfgashjdfgasdhjf",
"unique_name": "pablo.picasso@company.com",
"upn": "pablo.picasso@company.com",
"uti": "kajshdfkljahsdfkjahsdkjfahsd",
"ver": "1.0"
}
实际上,我正在寻找用户名。我们可以使用快捷方式或电子邮件登录Windows。因此,如果用户名是Pablo Picasso,则用户可以使用用户名PaPi登录。而我正在寻找。
答案 0 :(得分:2)
考虑到您已经知道how to get token。现在看下面的例子
如果您想使用employeeId
来获取identities
或officeLocation
或Microsoft Graph API
。
尝试以下方式:
Request:
https://graph.microsoft.com/v1.0/users?$select=employeeId ,identities ,officeLocation
Response:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(employeeId,identities,officeLocation)",
"@odata.nextLink": "https://graph.microsoft.com/v1.0/users?$select=employeeId+%2cidentities+%2cofficeLocation&$skiptoken=X%27445370740",
"value": [
{
"employeeId": 0200010000001C3A54696E614068616E,
"officeLocation": Redmond, Usa,
"identities": [
{
"signInType": "userPrincipalName",
"issuer": "someEmail.onmicrosoft.com",
"issuerAssignedId": "tenant.onmicrosoft.com"
}
]
}
}
请参见以下屏幕截图:
如果需要更多详细信息,请参阅Official document。
答案 1 :(得分:0)
我对所有字段的解决方法(没有mailboxSettings
,因为拒绝获取错误403访问权限)
https://graph.microsoft.com/v1.0/me?$select=aboutMe,accountEnabled,ageGroup,assignedLicenses,assignedPlans,birthday,businessPhones,city,companyName,consentProvidedForMinor,country,createdDateTime,creationType,deletedDateTime,department,displayName,employeeId,faxNumber,givenName,hireDate,id,identities,imAddresses,mailNickname,mobilePhone,mySite,officeLocation,onPremisesDistinguishedName,onPremisesDomainName,onPremisesExtensionAttributes,onPremisesImmutableId,onPremisesLastSyncDateTime,onPremisesProvisioningErrors,onPremisesSamAccountName,onPremisesSecurityIdentifier,onPremisesSyncEnabled,onPremisesUserPrincipalName,otherMails,passwordPolicies,passwordProfile,pastProjects,postalCode,preferredDataLocation,preferredLanguage,preferredName,provisionedPlans,proxyAddresses,refreshTokensValidFromDateTime,responsibilities,schools,showInAddressList,skills,signInSessionsValidFromDateTime,state,streetAddress,surname,usageLocation,userPrincipalName,userType,interests,isResourceAccount,jobTitle,lastPasswordChangeDateTime,legalAgeGroupClassification,licenseAssignmentStates,mail