none
Access SharePoint Online via REST API RRS feed

  • Question

  • Hi!

     

    I'm trying to use REST API to access company SharePoint Online in Python.

     

    For instance, the SharePoint folder I want to access is:https://company.sharepoint.com/sites/sitename/foldername. I have access to the site, and the folder, but no access to the company root.

     

    I tried two methods:

    Option 1: HttpNtlmAuth

    domain =  ' https://company.sharepoint.com/'

    url = ' https://marvell.sharepoint.com/sites/sse/_api/web/lists/GetByTitle(\'Sandbox\')/items'

    actual_username = domain + username

    response = requests.get(sharePointUrl,auth= HttpNtlmAuth(actual_username,password))

     

    Option 2: sharepy

    s = sharepy.connect("company.sharepoint.com")

     

    But both of them fails, and I get either 403, Forbidden, or 401 Client Error: Unauthorized for url.

     

    Can anyone help to check what might be the issue here?

     

    Thanks in advance!

     

    C.

    Friday, June 7, 2019 12:09 AM

All replies