简体   繁体   English

使用 Microsoft Graph API 显示 Office 365 用户即将到来的生日列表

[英]Display a list of upcoming birthdays of Office 365 users using Microsoft Graph API

Using the Microsoft Graph API, I want to create a list of all Office 365 users's birtdays, but I cannot get the list of users with the related properties at the moment.使用 Microsoft Graph API,我想创建所有 Office 365 用户生日的列表,但我目前无法获取具有相关属性的用户列表。

To set up this list I need the following properties exposed via the Graph API:要设置此列表,我需要通过 Graph API 公开以下属性:

  • id身份证
  • displayName显示名称
  • userPrincipalName用户主体名称
  • birthday生日

Using the Graph Explorer, https://graph.microsoft.io/en-us/graph-explorer , I've tried to request my own properties (graph.microsoft.com/v1.0/Me/?$select=id,displayName,userPrincipalName,birthday) which works:使用图形资源管理器https://graph.microsoft.io/en-us/graph-explorer ,我尝试请求我自己的属性 (graph.microsoft.com/v1.0/Me/?$select=id ,displayName,userPrincipalName,birthday) 工作原理:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(id,displayName,userPrincipalName,birthday)/$entity",
    "id": "aaaaaaaa-bbbbb-ccccc-a3c6-63817c4bbbca",
    "displayName": "Harold van de Kamp",
    "userPrincipalName": "harold@company.com",
    "birthday": "2000-08-15T00:00:00Z"
}

When I query all users (graph.microsoft.com/v1.0/Users), that also works, but doens't contain all the required properties当我查询所有用户(graph.microsoft.com/v1.0/Users)时,这也有效,但不包含所有必需的属性

But when I query all users with the required properties (graph.microsoft.com/v1.0/Users/?$select=id,displayName,userPrincipalName,birthday), I get the following error:但是当我使用所需的属性(graph.microsoft.com/v1.0/Users/?$select=id,displayName,userPrincipalName,birthday)查询所有用户时,我收到以下错误:

{
    "error": {
        "code": "InternalServerError",
        "message": "This operation is not yet supported.",
        "innerError": {
            "request-id": "06a7b9c9-2fcd-4f26-a86c-fe9704a35a1e",
            "date": "2016-06-11T11:15:45"
        }
    }
}

Querying the beta API (graph.microsoft.com/beta/Users/?$select=id,displayName,userPrincipalName,birthday) results in the same error.查询 beta API (graph.microsoft.com/beta/Users/?$select=id,displayName,userPrincipalName,birthday) 会导致相同的错误。

Question : Any idea why I get this error and how can we get this working?问题:知道为什么会出现此错误以及我们如何使其正常工作吗?

Bonus question : Is it possible to directly query only a list of upcoming 15 birthdays?奖励问题:是否可以直接查询即将到来的 15 个生日的列表?

Sorry Harold, but unfortunately as the error message says, this is not currently supported.抱歉 Harold,但不幸的是,正如错误消息所述,目前不支持此功能。 Behind the scenes Microsoft Graph is farming out requests for data to multiple services.在幕后,Microsoft Graph 正在向多个服务发出数据请求。 While Microsoft Graph does support paging within services, it doesn't yet support paging (or expand) across services.虽然 Microsoft Graph 支持服务分页,但尚不支持跨服务分页(或扩展)。 This is something that we will be working on, but no ETA yet I'm afraid.这是我们将要做的事情,但恐怕还没有预计到达时间。

解决方法可能是单独访问该属性: https://graph.microsoft.com/v1.0/users/<id_or_principle_name>/birthday : https://graph.microsoft.com/v1.0/users/<id_or_principle_name>/birthday

不确定您是否找到了解决方法,但我们所做的(有相同的要求)是我们能够从我们的本地 AD 映射自定义生日属性 -> 使用 DirSync 将其同步到 Azure AD,然后它成为扩展属性供我们取用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Microsoft Graph Api 获取 Office 365 的邮件大小? - How to get the message size of Office 365 using Microsoft Graph Api? 无法使用图形API列出具有管理员凭据的Office 365域中的用户 - Could not list the users in the Office 365 domain with administrator credentials using graph api 如何使用MS Graph API列出Office 365德国域中的用户? - How to list users in the Office 365 Germany domain using MS Graph API? 尝试使用Microsoft Graph API获取Office 365帐户的联系人 - Trying to get Contacts for an Office 365 account using Microsoft Graph API 如何在 Office 365 中添加用户并使用图 api 分配许可证 - How to add users in Office 365 and assign license using graph api 如果为Office 365租户禁用了办公图,Microsoft Graph API是否可以工作? - Will Microsoft Graph API work if office graph is disabled for the Office 365 tenant? WordPress上的Microsoft Office 365用户 - Microsoft Office 365 users on WordPress 使用服务主体登录Microsoft Graph / Office 365 REST API - Microsoft Graph / Office 365 REST API login with service principal 如何从Microsoft Graph API for Office 365获取国家/地区? - How to get country from Microsoft Graph API for Office 365? Microsoft Graph - Office 365 API,获取有关邮箱的信息 - Microsoft Graph - Office 365 API , Obtain Information about mailbox
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM