1

Been trying to access SharePoint list and download the data as a CSV using Python for a use case. Once we arrive at the authentication step, we get the error

"('Error authenticating against Office 365. Error from Office 365:', 'AADSTS50059: No tenant-identifying information found in either the request or implied by any provided credentials.')"


from config import config

from shareplum import Site 
from shareplum import Office365
from shareplum.site import Version
from requests_ntlm import HttpNtlmAuth

from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.client_context import ClientContext

base_path = config.config['sp_base_path']
username = config.config['sp_user']
password = config.config['sp_password']


##Approach 1
# cred = HttpNtlmAuth('myusername@domain.com', 'Password')
# site = Site('https://xxxxxx.sharepoint.com/logs/Lists/Logs%20Entries/All%20Items.aspx', auth=cred)


##Approach 2
# authcookie = Office365(base_path, username=username, password=password).GetCookies()
# site = Site('https://xxxxxx.sharepoint.com/logs/Lists' ,version=Version.v365, authcookie=authcookie)

Both Approach 1 and Approach 2 throws the same error.

1 Answers1

0

From the error message you provided, it could be that the authentication process was unable to identify the SharePoint tenant based on the provided credentials.

Maybe you can try to use "Office365" authentication method provided by "shareplum" library instead of using "requests_ntlm" library for authentication.

https://shareplum.readthedocs.io/en/latest/tutorial.html#:~:text=The%20Office365%20class%20grabs%20a%20login%20token%20from,site%20in%20Office365%20and%20add%20Https%3A%2F%2F%20at%20start.