I'm trying to upload file to sharepoint using app only credentials but it fails at the auth step. not sure what is the problem here, also verified the permission on the app id but still no luck.
any inputs is greatly appreciated!!
error message
TypeError: init() got an unexpected keyword argument 'url'
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.files.file import File
site_url = 'https://contoso.sharepoint.com/'
app_principal = {
'client_id': '--client-id-goes-here--',
'client_secret': '--client-secret-goes-here--',
}
context_auth = AuthenticationContext(url=site_url)
context_auth.acquire_token_for_app(client_id=app_principal['client_id'], client_secret=app_principal['client_secret'])
ctx = ClientContext(site_url, context_auth)
web = ctx.web
ctx.load(web)
ctx.execute_query()
print("Web site title: {0}".format(web.properties['Title']))
CodePudding user response:
The url should be like following
site_url = 'https://contoso.sharepoint.com/sites/xxx'
