Update users¶
Permissions
Requires delegated permission User.ReadWrite.All.
Reference¶
- https://learn.microsoft.com/en-us/graph/api/user-update
- https://learn.microsoft.com/en-us/graph/api/resources/user
from office365.graph_client import GraphClient
from tests import test_client_id, test_password, test_tenant, test_username
client = GraphClient(tenant=test_tenant).with_username_and_password(test_client_id, test_username, test_password)
users = client.users.get().filter("startswith(displayName, 'testuser')").top(1).execute_query()
for u in users:
u.set_property("officeLocation", "18/2111").update().execute_query()