如何在Android应用程序中访问graph.windows.net Microsoft Azure Graph API? [英] How to access graph.windows.net Microsoft Azure Graph API in an android app?

查看:175
本文介绍了如何在Android应用程序中访问graph.windows.net Microsoft Azure Graph API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经要求我的IT管理员以目录扩展名的形式添加一个名为EmployeeId的属性到与我们的现场AD同步的天蓝色活动目录.当他们登录我的android应用时,我正在尝试为给定用户检索此值.

I've asked my IT Admin to add an attribute called EmployeeId in the form of a directory extension to azure active directory which syncs with our onsite AD. I'm trying to retrieve this value for a given user when they sign into my android app.

我遵循了指南,该指南使我可以使用当前登录的用户(例如,给定名称,姓氏等)从URL graph.microsoft.com检索数据.

I've followed this guide which has allowed me to retrieve data from the URL graph.microsoft.com with the currently logged in user i.e. givenname, surname etc.

问题是,当我运行架构扩展(https://graph.microsoft.com/beta/schemaExtensions)的get请求以尝试检索EmployeeId时,它只会返回一些有关该属性的元数据,而不是该属性它自己:

The issue is that when I run the get request for schema extensions (https://graph.microsoft.com/beta/schemaExtensions) to try to retrieve the value of EmployeeId it just returns some metadata about the attribute, not the attribute it'self:

{
        "id": "exti1rcdc4h_Employee",
        "description": "Baker is testing extension",
        "targetTypes": [
            "user"
        ],
        "status": "Available",
        "owner": "XXXXXXXXXXXXXXXXXX",
        "properties": [
            {
                "name": "EmployeeId",
                "type": "Integer"
            }
        ]
    }

经过一些研究,我发现我可以使用图形浏览器轻松检索值(通过使用get请求https://graph.windows.net/mydomain.com/users/user@mydomain.com).

After doing some research I've found that i can use this graph explorer to easily retrieve the value (by using the get request https://graph.windows.net/mydomain.com/users/user@mydomain.com).

但是问题是URL graph.explorer.net似乎与上述指南不兼容.

The issue is however that the URL graph.explorer.net doesn't seem to be compatible with the guide mentioned above.

是否有更好的方法来解决此问题?

Is there a better way to approach this issue?

-编辑-

请澄清一下,我只能使用 Azure AD Graph资源管理器成功检索extension_980f32feca7d475f9e1b90a410dbee63_employeeID的值 Microsoft图形资源管理器上访问/users端点时,不会返回该值

Just to clarify I was only able to retrive the value for extension_980f32feca7d475f9e1b90a410dbee63_employeeID successfully using the Azure AD Graph explorer the value is not returned when i access the /users endpoint on Microsoft graph explorer

在GET https://graph.microsoft.com/v1.0/users请求中为每个用户返回的数据:

Data returned for each user in GET https://graph.microsoft.com/v1.0/users request:

"id": "d0be2ebd-0c7b-4c10-aebe-9db4c90a9594",
        "businessPhones": [],
        "displayName": "username",
        "givenName": "Jhon",
        "jobTitle": null,
        "mail": "user@mydomain.com",
        "mobilePhone": null,
        "officeLocation": null,
        "preferredLanguage": null,
        "surname": "Smith",
        "userPrincipalName": "user@mydomain.com"

推荐答案

是可以的.您应该能够运行几个不同的查询,例如:

Yes this is possible. You should be able to run a couple of different queries like:

  1. 使用特定的employeeId查找用户:

GET https://graph.microsoft.com/v1.0/users?$filter=extension_980f32feca7d475f9e1b90a410dbee63_employeeID eq 'S09655'

  1. 获取所有用户及其employeeId(需要使用$ select)

GET https://graph.microsoft.com/v1.0/users?$select=id,displayName,extension_980f32feca7d475f9e1b90a410dbee63_employeeID

此外(在积压中,但仍在积极进行中),我们正在努力以本地方式将本地employeeId作为Microsoft Graph中user实体上的一流属性公开.我目前还没有预计到达时间.

Additionally (in the backlog, but actively in progress) we are working to expose on-premises employeeId natively as a first-class property on the user entity in Microsoft Graph. I don't have an ETA for this yet though.

希望这会有所帮助,

这篇关于如何在Android应用程序中访问graph.windows.net Microsoft Azure Graph API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆