Skip to content

Add mapping for complex attributes#1154

Merged
alejcas merged 2 commits intoO365:masterfrom
RogerSelwyn:issue_684
Apr 22, 2025
Merged

Add mapping for complex attributes#1154
alejcas merged 2 commits intoO365:masterfrom
RogerSelwyn:issue_684

Conversation

@RogerSelwyn
Copy link
Contributor

#684

In support of this issue, this adds the ability to convert a select attribute from a simple attribute to a complex one required by MS Graph.

Copy link
Member

@alejcas alejcas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First I have write a new Query class that I want to replace the old one.
You can check it here.

Also I've added a comment on a line that needs to change.

@alejcas alejcas merged commit ea6a8cc into O365:master Apr 22, 2025
@alejcas
Copy link
Member

alejcas commented Apr 22, 2025

Also, I will be thankful if you can try the new Query.
It works like this:

# here you have you account set up:
from O365.utils import ExperimentalQuery

builder = ExperimentalQuery(protocol=account.protocol)

query = builder.equals("name", "James") | builder.equals("address", "james@example.com")
query = query & builder.orderby("name", "address")

# then use query as where the old query was used in the same way

For example to add select just mix whatever part with builder.select with the & operator

@alejcas
Copy link
Member

alejcas commented Apr 22, 2025

Also, I will be thankful if you can try the new Query. It works like this:

The reasons for a new query builder are:

  • Allows for more deep operations like using iterator like any or all over complex attributes or deep collections
  • It's way more simple and error prone.
  • It allows for the use of & and | operators (but also implements `builder.chain_and/chain_or")
  • It allows to group filters explicitly in the way you like with builder.group
  • It properly manages the negate condition being explicit about it's use with builder.negate

@RogerSelwyn RogerSelwyn deleted the issue_684 branch April 24, 2025 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants