Office365-REST-Python-Client icon indicating copy to clipboard operation
Office365-REST-Python-Client copied to clipboard

Granting user from client_people_picker access using add_role_assignment

Open unicornsandpandas opened this issue 2 years ago • 0 comments

Hi,

I'm trying to programmatically create a file in my Sharepoint site and enable access to an arbitrary user from my Enterprise. When querying for a via

ctx = ClientContext(...)

user = ctx.web.site_users.get_by_email(user_email)

target_file.listItemAllFields.add_role_assignment(user, role_def).execute_query()

It appears that not all the users that are available in the web interface are available in the web site_users query. I can however find all the users using the client_people_picker_search_user API.

Is there a way to pass the found user from the people picker user search API into the add_role_assignments call?

unicornsandpandas avatar Sep 07 '23 19:09 unicornsandpandas