如何在数组对象上建立Ms图api查询过滤器?

问题描述 投票:0回答:1

我计划利用 列表组女士图API 来列出我的组织中的O365群组,并在之后对它们进行Yammer群组过滤。

当我在graph explorer中使用这个API时,它返回以下响应对象。

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#groups",
  "@odata.nextLink": "https://graph.microsoft.com/v1.0/groups?,
  "value": [
    {
      "id": "",
      "description": "",
      "displayName": "",
      "groupTypes": [
        "Unified"
      ],
      "isAssignableToRole": null,
      "mail": "",
      "mailEnabled": true,
      "mailNickname": "",
      "onPremisesDomainName": null,
      "onPremisesLastSyncDateTime": null,
      "onPremisesNetBiosName": null,
      "onPremisesSamAccountName": null,
      "onPremisesSecurityIdentifier": null,
      "onPremisesSyncEnabled": null,
      "preferredDataLocation": null,
      "proxyAddresses": [
        "",
        "SMTP:",
        "smtp:"
      ],
      "renewedDateTime": "2018-09-07T16:23:37Z",
      "onPremisesProvisioningErrors": []
    },
    {
      "id": "",
      "deletedDateTime": null,
      "classification": null,
      "createdDateTime": "2019-01-11T17:34:30Z",
      "**creationOptions**": [
        "Team",
        "ExchangeProvisioningFlags"
      ],
      "description": "Discuss",
      "displayName": "I&O",
      "groupTypes": [
        "Unified"
      ],
      "isAssignableToRole": null,
      "mail": "",
      "preferredDataLocation": null,
      "proxyAddresses": [
        "SPO",
        "SMTP:",
        "smtp:"
      ],
      "renewedDateTime": "2019-01-11T17:34:30Z",
      "resourceBehaviorOptions": [],
      "resourceProvisioningOptions": [
        "Team"
      ],
      "onPremisesProvisioningErrors": []
    },
    {
      "id": "",
      "deletedDateTime": null,
      "classification": null,
      "createdDateTime": "2018-12-10T21:14:47Z",
      "**creationOptions**": [
        "YammerProvisioning"
      ],
      "description": "",
      "displayName": "",
      "groupTypes": [
        "Unified"
      ],
      "isAssignableToRole": null,
      "mailEnabled": true,
      "onPremisesDomainName": null,
      "onPremisesLastSyncDateTime": null,
      "onPremisesNetBiosName": null,
      "onPremisesSamAccountName": null,
      "onPremisesSecurityIdentifier": null,
      "onPremisesSyncEnabled": null,
      "preferredDataLocation": null,
      "proxyAddresses": [],
      "renewedDateTime": "2018-12-10T21:14:47Z",
      "resourceBehaviorOptions": [
        "CalendarMemberReadOnly"
      ],
      "resourceProvisioningOptions": [],
      "onPremisesProvisioningErrors": []
    }
  ]
}

正如你所看到的,在json中的每个对象都有'createOptions',这意味着一个群组可能有这个字段被填充了一些值。我感兴趣的是只返回那些createOptions = YammerProvisioning的组。

但是$filter只能应用于字符串而不是数组,所以我不知道如何才能正确查询。我试过以下方法,但是,它的无效过滤子句。

https://graph.microsoft.com/v1.0/groups?$filter=equals(creationOptions,'YammerProvisioning')

我尝试的另一种方法是如下,它给出了相同的数组。

https://graph.microsoft.com/v1.0/groups?$filter=startswith(creationOptions,['YammerProvisioning'])

我的目标是简单地获取所有的组有创建选项为'YammerProvisioning'。

希望得到帮助或例子:) 谅谅

microsoft-graph microsoft-graph-excel
1个回答
1
投票

这个语法应该可以用,但是在v1.0版本中可能不支持。$filter=creationOptionsany(r:r+eq+'YammerProvisioning')

Beta端点似乎没有createOptions,但你可以尝试去反对resourceBehaviorOptions。

https:/www.techmikael.com201711how-to-list-all-office-365-groups-which.html?m=1

虽然在所有租户中并不可靠("然而,并不是所有启用Yammer的群组都会通过查看ResourceBehaviorOptions来报告。似乎在迁移前已经使用Office 365群组的Yammer社区已经配置了该属性,而在迁移过程中转换为Office 365群组的社区却没有配置。也许一些后台程序会随着时间的推移更新其他群组的属性。")https:/office365itpros.com20200413moving-yammer-networks-nativeod-microsoft-365。

© www.soinside.com 2019 - 2024. All rights reserved.