Skip to content

Instantly share code, notes, and snippets.

@svarukala
Last active January 27, 2021 01:06
Show Gist options
  • Save svarukala/347feabafd70d50dedb28ff8bbbb62da to your computer and use it in GitHub Desktop.
Save svarukala/347feabafd70d50dedb28ff8bbbb62da to your computer and use it in GitHub Desktop.
Python sample to get a SharePoint Online Site title
from office365.runtime.auth.client_credential import ClientCredential
from office365.sharepoint.client_context import ClientContext
client_id = '--clientid--'
client_secret = '--clientsecret---'
site_url = 'https://contoso.sharepoint.com/sites/Web01'
credentials = ClientCredential(client_id,
client_secret)
ctx = ClientContext(site_url).with_credentials(credentials)
target_web = ctx.web.get().execute_query()
print(target_web.url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment