-
Notifications
You must be signed in to change notification settings - Fork 423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
O365.utils.utils.Query.any does not support negate() and does not follow the group? #1058
Comments
query.open_group().negate() Does nothing. assign to query again: query = query.open_group().negate() and do the same for the following |
Thanks, i've tried as you says. The result is the same. The not negation is not added to the filter. This is the code:
this is the filter created: |
I see! I'll try to fix it Query can either be a Query object or a string, so pass the string filter you want for now |
Fixed: Negations are now correctly consumed when used in: open groups, logical operators, functions and iterables.
Fixed in 094399b To negate groups (or anything) the negate should go BEFORE the action, so: query = mailbox.new_query()
query = query.negate().open_group() # negate goes first! or otherwise will negate the first any on the group
query = query.any(collection='categories', word="Category1", operation='eq')
query = query.chain('or')
query = query.any(collection='categories', word='Category2', operation='eq')
query = query.close_group() You can also negate the condition inside the 'any' or 'all' iterables using the negation argument: query = mailbox.new_query()
query = query.negate().any(collection='categories', word="Category1", operation='eq', negation=True)
print(query) This outputs: Filter: not categories/any(a:not a eq 'Category1')
Order: None
Select: None
Expand: None
Search: None Please report back if this now works as expected Thanks |
Hi, i was trying to rewrite this query that is working with Psotman and the O365 messages endpoint:
NOT(categories/any(a:a eq 'Category1') or categories/any(a:a eq 'Category2'))
I had thought that this could have been the equivalent code (Note: the operation=ne is not supported with categories):
but the output had the "not" missing:
Filter is: {'$filter': "(categories/any(a:a eq 'Category1') or categories/any(a:a eq 'Category2'))"}
With the on_Attribute method the filter is producing this output:
Query:
Output:
Filter is {'$filter': "(not contains(subject, 'value1') or not contains(subject, 'value2'))"}
I would expect this output:
{'$filter': "not(contains(subject, 'value1') or contains(subject, 'value2'))"}
any hint?The text was updated successfully, but these errors were encountered: