79562958

Date: 2025-04-08 20:08:28
Score: 0.5
Natty:
Report link

Yes it is possible, but there are many layers to how Sharepoint allows enterprises to provision such access. You stated you have admin access, but I do not know if that is an admin of the device, enterprise network sysadmin, general enterprise admin of Sharepoint, or specific Sharepoint site admin. Each level of these would need to be approved in order to invoke API uploads to Sharepoint, the level of headache that that will create is dependent on how your enterprise has configured everything.

In the code you shared I only see one thing potentially missing, which is the office365 AuthenticationContext class instance. The AuthenticationContext normally handles all of the credential and access hand off stuff behind the scenes and has generally be a lifesaver for me when automating Sharepoint uploads and downloads. Historically I have had mixed success when doing all the credential stuff by hand, but had it work on the first attempt almost all the time with AuthenticationContext. You can read more about it on its github file:

https://github.com/vgrem/Office365-REST-Python-Client/blob/master/office365/runtime/auth/authentication_context.py

If you are experiencing any further issues while using AuthenticationContext, it may be worth double checking all of the syntax it requires. If you are still having issues you may need to ask your enterprise to double check that (i) they allow API uploads, and (ii) that you and how your are configured is fully allowed to execute. The Exceptions that you get in the event that either of these is not working will normally be (a) some sort of request denial straight up saying that you do not have appropriate access to something, (b) some more generally vague message that the Sharepoint you are requesting cannot be found even though you know you entered the correct one, or most frustratingly (c) some random function that is taking an API action crashes, which would be the case if the API allows the request to go through but blocks you from taking any action.

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (1):
Posted by: mcbw