pypi Office365-REST-Python-Client 2.5.8
v 2.5.8

latest release: 2.5.9
one month ago

Changelog

  • SharePoint resources addressing enhancements
  • introduced methods for granting and revoking delegated & application permissions

Example 1: grant an app role to a client service principal

client = GraphClient.with_token_interactive(
    tenant_name_or_id, app_client_id, admin_principal_name
)

resource = client.service_principals.get_by_name("Microsoft Graph")
app = client.applications.get_by_app_id(app_client_id)
resource.grant_application(app, "MailboxSettings.Read").execute_query()

Example 2: grant a delegated permission to the client service principal on behalf of a user

client = GraphClient.with_token_interactive(
    tenant_name_or_id, app_client_id, admin_principal_name
)

resource = client.service_principals.get_by_name("Microsoft Graph")
app_role = "User.Read.All"
user = client.users.get_by_principal_name(test_user_principal_name)
resource.grant_delegated(app_client_id, user, app_role).execute_query()

Don't miss a new Office365-REST-Python-Client release

NewReleases is sending notifications on new releases.