0

I wrote a small script that goes through a bunch of folders and consolidates excel files.

Now I would like to use this script with files stored in our company sharepoint. Since getting support from our IT is not an option and I am looking to do this myself. I seem to get stuck at the authentication part though. Our sharepoint uses the windows credentials to connect to it, I dont have more information.

Any pointers would be helpful, I am gonna list some methods that I tried so far. Usually I get Error 401.

I tried: http://docs.python-requests.org/en/latest/user/authentication/,

https://stackoverflow.com/questions/25764595/accessing-sharepoint-site-in-python-with-windows-authentication

I tried this code:

import requests
from requests_ntlm import HttpNtlmAuth
requests.get("http://sharepoint-site.com", auth=HttpNtlmAuth('DOMAIN\\USERNAME','PASSWORD'))

I dont know where to go from here, any pointers or ways to find out more information what type of authentication my sharepoint has would already be helpful.

0

If you are using SharePoint file libraries rather than lists you should just be able to give the server path to the file library as the folder path, instead of bothering with any SharePoint APIs.

For instance if your SharePoint site is SharePoint.Company.net/sites/sitename/LibraryName your server path to that Library might (as an example with SSL) be \\SharePoint.Company.net@SSL\sites\sitename\LibraryName.

This works on my company's.

The easiest way to get the correct path to use is to go to the library in IE and use the open with explorer button. Then use that URL to map the drive to a letter and the mapped details will then give the details you need. Then you can just reference that path like a normal folder path as if it was part of your local drives.

  • @Robert Lindgren Thanks for the reply. But this would propably also mean, that this script would already require an active sharepoint connection right? As in, I have to be logged in and at my pc to run this? – Tim Aug 22 '18 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.