Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Global address book filter with multiple paramaters #18

Closed
Xalaxis opened this issue Nov 12, 2018 · 2 comments
Closed

Global address book filter with multiple paramaters #18

Xalaxis opened this issue Nov 12, 2018 · 2 comments

Comments

@Xalaxis
Copy link

Xalaxis commented Nov 12, 2018

I seem to be having problems using a query with multiple parameters. The code below works if the "q.endswith" line is removed.

global_address_list = account.address_book(address_book='gal')
q = global_address_list.new_query('display_name')
q.startswith("John")
q.endswith("Smith")
print(global_address_list.get_contacts(query=q, limit=5))

Client Error: 400 Client Error: Bad Request for url: https://graph.microsoft.com/v1.0/users?%24top=5&%24filter=startswith%28displayName%2C+%27John%27%29+and+endswith%28displayName%2C+%27Smith%27%29

@alejcas
Copy link
Owner

alejcas commented Nov 12, 2018

Hi, this has nothing to do with the pyo365 library.

The filters (and number of filters) allowed by Microsoft on the graph (and office 365 Rest ) api are very obscure and varies depending on the resource retrieved.

Currently the OData keyword 'endswith' is not supported by Microsoft Graph (who knows in the future).
For example the 'contains' keyword is sometimes supported. But not in the 'users' endpoint that the global address book uses.

Try to use the Graph Explorer to see if the filters you apply work or not.

@Xalaxis
Copy link
Author

Xalaxis commented Nov 12, 2018

Okay, thank you.

@Xalaxis Xalaxis closed this as completed Nov 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants