使用startswith()过滤outlook API中的联系人

时间:2017-03-15 10:43:50

标签: odata office365 outlook-restapi

我正在尝试获取通过Microsoft Outlook API(Contact API)的电子邮件地址过滤的联系人列表。我用于请求的网址是:

https://outlook.office.com/api/v2.0/me/contacts/?$filter=EmailAddresses/any(email: startswith(email/Address,'ab'))

过滤器属性$filter=EmailAddresses/any(email: email/Address eq 'ab')工作正常。

此处EmailAddresses字段是包含名称,地址字段的列表。

  

更新

     

原始回复:

    {
      "@odata.context": "https://outlook.office.com/api/v2.0/$metadata#Me/Contacts",
      "value": [
        {
          ..................................
          ..................................

          "DisplayName": "Abhishek R",
          "GivenName": "Abhishek",
          "Initials": null,
          "MiddleName": null,
          "NickName": null,
          "Surname": "R",
          "Title": null,
          "YomiGivenName": null,
          "YomiSurname": null,
          "YomiCompanyName": null,
          "Generation": null,
          "ImAddresses": [],
          "JobTitle": null,
          "CompanyName": null,
          "Department": null,
          "OfficeLocation": null,
          "Profession": null,
          "BusinessHomePage": null,
          "AssistantName": null,
          "Manager": null,
          "HomePhones": [],
          "MobilePhone1": null,
          "BusinessPhones": [],
          "SpouseName": null,
          "PersonalNotes": null,
          "Children": [],
          "EmailAddresses": [
            {
              "Name": "abhishek@gmail.com",
              "Address": "abhishek@gmail.com"
            },
            {
              "Name": "abcdef@gmail.com",
              "Address": "abcdef@gmail.com"
            }
          ],
          "HomeAddress": {},
          "BusinessAddress": {},
          "OtherAddress": {}
        }
      ]
    }

我得到的回应是:

{
  "error": {
    "code": "ErrorInvalidUrlQueryFilter",
    "message": "The query filter contains one or more invalid nodes."
  }
}

寻找解决方案。

0 个答案:

没有答案