JonathanHolvey / sharepy

Simple SharePoint authentication for Python
GNU General Public License v3.0
175 stars 52 forks source link

Support different sites in Sharepoint, requires full site URL when fetching digest #76

Open Jamie- opened 1 year ago

Jamie- commented 1 year ago

Most endpoints in the SPOL auth class appear to need just the Sharepoint FQDN (e.g. mycompany.sharepoint.com) However for the digest to be valid when working with sites (e.g. mycompany.sharepoint.com/sites/MySite), the digest needs to be fetched for the correct site.

With these changes, when working with sites, connect using e.g.

sharepy.connect("https://mycompany.sharepoint.com/sites/MySite")

Although the code is robust to with/without https?:// and with/without trailing /.

Without these changes, when trying to upload a file to a Sharepoint site (e.g. mycompany.sharepoint.com/sites/MySite) I get the error:

The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.
dltacube commented 9 months ago

This PR fixed an issue I was having as well. Any interest in adding this work @JonathanHolvey?