【问题标题】:azure - user info - get moreazure - 用户信息 - 获取更多信息
【发布时间】:2020-06-30 15:23:51
【问题描述】:

我在 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 登录。我正在寻找那个。

【问题讨论】:

  • 缺少哪些信息?
  • 我们可以使用快捷方式或电子邮件登录Windows。因此,如果用户名是 Pablo Picasso,则用户可以使用用户名 PaPi 登录。我正在寻找那个。
  • Microsoft Graph 提供these user property 所以你只能得到这些。
  • 好的,那么如何将employeeIdidentitiesofficeLocation 放入我的JSON 中? :)
  • 如果您有任何疑问,请查看答案并随时分享

标签: azure oauth oauth-2.0 azure-active-directory microsoft-graph-api


【解决方案1】:

考虑到,您已经知道how to get token。现在看下面的例子

如果您想获取employeeIdidentitiesofficeLocation 使用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

【讨论】:

  • 有没有获取所有字段的选项? :) 并查看有关用户的所有信息? https://graph.microsoft.com/v1.0/me 仅显示基本信息,要获得 employeeId 我需要将其添加到 $select。我可以获取所有字段吗?
  • 不,没有这样的选项。在这种情况下,您必须在 $select 部分添加所需的属性。
【解决方案2】:

谢谢Md Farid Uddin Kiron

我对所有字段的解决方法(没有 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-05
    • 2012-01-04
    • 1970-01-01
    • 1970-01-01
    • 2011-03-13
    相关资源
    最近更新 更多