Questions tagged [python]
The python tag has no usage guidance.
40 questions
0
votes
1
answer
19
views
How to run a Python script on a SharePoint list in order to generate a PowerPoint file?
I currently have a local Python script that takes a CSV file (downloaded manually from SharePoint using the "Export as CSV" button) as input, processes the data, and generates a custom ...
0
votes
1
answer
33
views
POSTing a file to sharepoint sub-site returns a 403, while it works on the root
My python script below to upload a file (without a specific user account) to a sharepoint is working, however only when I upload to the root. When I try to use the url of a sub-site I receive a 403 ...
0
votes
0
answers
47
views
Error using MSGraph python API for SharePoint when trying to move files
I am trying to utilize the MSGraph API in Python in order to move SharePoint files around based on some input. I currently have the download part of the API settled, but moving the file does not work ...
0
votes
0
answers
20
views
If/Then Python Script for SharePoint
We have thousands of construction blueprints in PDF format, many go back decades. Many blueprints are duplicates created accidentally because we never established a proper naming procedure. So a ...
0
votes
0
answers
91
views
Download aspx pages using python in local
I have a client ID and secret of my SharePoint.
I have some SharePoint page URLs, which I need to download them to the local using python.
It will good if I can download them as pdf, but as of now, I ...
0
votes
0
answers
77
views
Upload to sharepoint python okta sso login
I want to upload a file to share point, but it ask for a username and password as a real use case we might not be able to provide the details and we uses OKTA for authentication using SAML. Basically ...
0
votes
0
answers
77
views
Downloading files inside the subfolders of a Main folder in Sharepoint
I am trying to download all the files within 4 (or more) subfolders which is inside the main folder named 'Reports' in Sharepoint.
I used the following code:
url = 'https://HAHA.sharepoint.com/sites/...
0
votes
1
answer
121
views
Why "target_folder.upload_file(sFilename, file_content).execute_query()" is not overwriting the existing file in SharePoint?
I have kept some files in a Share Point folder. I need to run a python script to update the files daily.
Code -
from office365.runtime.auth.authentication_context import AuthenticationContext
from ...
1
vote
0
answers
387
views
How to get all files and folders on a SharePoint site, using office 365 REST API for python?
I want to automate downloading all the documents in multiple SharePoint sites with python, so I want a way to get all folders and files in a "Shared Documents" library in SharePoint sites.
...
0
votes
2
answers
561
views
Can access web.properties but not files error - using Office365-REST-Python-Client
I'm using Office365-REST-Python-Client to access some files from Sharepoint through a Python script (using App-only method)
a code example would be this:
credentials = ClientCredential(x, y)
ctx = ...
0
votes
0
answers
2k
views
Sharepoint API using python: what is the relative path of my folders?
I'm trying to upload files automatically from a python script using the office365.sharepoint package. I can authenticat using a client id and secret (app_principal). However, when I try to get a file ...
0
votes
1
answer
980
views
Read large lists with Office365-REST-Python-Client
I am currently trying to read only the last week's entries of a few lists, and I accomplish this by using filter("Modified gt datetime{date_in_isoformat}') or order_by("Modified desc")....
1
vote
0
answers
1k
views
Unable to post message on Teams using Microsoft Graph API
I am trying to post message on a teams channel but I am not able to do that.
I have got the required permissions also - Teamwork.Migrate.All.
The following code snippet is being used:
import requests
...
0
votes
1
answer
404
views
Can we execute a python script within SPFX webpart
I have a python script which uses some python libraries to do decrypting and encryption . Is there a way where I can invoke this script inside the webpart code.
1
vote
1
answer
3k
views
Getting -"Either scp or roles claim need to be present in the token" and Access Denied while using Graph API to upload files to SharePoint
Initially when I tried to generate the token using the URL - https://login.microsoftonline.com/tenant-id/oauth2/v2.0/token I was able to fetch the Bearer token using grant_type, client_id, scope and ...
0
votes
1
answer
996
views
Bad Request for URL- 400
400 Client Error: Bad Request for url:
https://XXXXX.sharepoint.com/sites/QE/_api/Web/getFolderByServerRelativeUrl('Shared Documents/product-health-metrics')/Files/add(overwrite=true,url='C:/Users/...
0
votes
1
answer
2k
views
Trying to upload files to sharepoint using REST API ,Python using Postman
import requests
url = "https://xxxxxx.sharepoint.com/sites/QE/Shared%20Documents/_api/GetFolderByServerRelativeUrl('product-xxxxx-metrics/xxxxx-dashboard-automation')/Files/add(url='test.csv',...
1
vote
2
answers
815
views
Office365-REST-Python-Client copy between two sites
I am struggeling to copy a file from one sharepoint site to another. Lets say i want to copy from: https://test.sharepoint.com/Site1/A/
to : https://test.sharepoint.com/Site2/B/
i have not yet found a ...
0
votes
2
answers
1k
views
Unable to update list item using POST and REST, but able to preform other POST tasks. Using Python Requests and Sharepy
I'm able to authenticate and run GET and POST commands. But I am unable to update a list item. Or create a new list item.
I'm using Python Requests and Sharepy(handles authentication). What am I ...
1
vote
0
answers
1k
views
Download file using python from sharepoint's generated link (Copy link)
I'm looking for a python way to download a SharePoint URL which looks like this:
https://<tenant>.sharepoint.com/:v:/s/<site_name>/EWrCISgzqYFOj8SAHhogWCcBuKyGUDTsy6dENyFJgb_l_w?e=r8KVDN
&...
1
vote
0
answers
143
views
Plotting of list data using pyscript
I have SharePoint 2013 and 2016 environments that I like to add some plots for some custom lists (webapp part) of SharePoint.
I thought of using pyscript but I couldn't go too much further as I can't ...
0
votes
1
answer
1k
views
How to exceed the Sharepoint 5000 threshold in Rest-API Python
I can't use Office365-REST-Python-Client to retrieve Sharepoint files because it's only works on Windows not on Linux - Docker (it throws error:
File "/usr/local/lib/python3.8/site-packages/...
0
votes
0
answers
462
views
Using Office365-REST-Python-Client doesnt work on an external company's sharepoint
I've written a code in python using Office365-REST-Python-Client. It works perfectly well on myCompany's sharepoint site. But in another company's sharepoint site, I am getting auth token errors. I ...
0
votes
1
answer
65
views
Send email to users with expired documents
I want to be able to send email to each user which has expired documents and be able to know when the expiry date email was sent. The item contains worker name, their expiry date, and the heading of '...
0
votes
1
answer
2k
views
The Error validating credentials due to invalid username or password comes up when trying to upload files to SharePoint by a python script
I am trying to upload files to a SharePoint folder structure which has been already created, I have used two files for this
Config_template:
config = dict()
config['sp_user'] = '[email protected]'
config['...
1
vote
0
answers
24
views
sharepoint power bi libraries
I published power bi reports to cloud service. Power BI reports include python codes but python path is connected to SharePoint folder. But the problem is the python libraries. How can I install ...
0
votes
1
answer
1k
views
How to update the value of a choice/multichoice column in Sharepoint online through coding
Is there a way through using a piece of code to update all the specific values of a column of SharePoint online to something else?
I am looking for an equivalent of the below SQL code for Sharepoint ...
1
vote
1
answer
262
views
How to modify the same attribute of multiple lists with exact schemas in Sharepoint online through coding or ms flow
I have several lists with the same exact schemas in SharePoint Online. How can I do the following?
1- How to add/remove a column to/from all of them?
2- How to add/remove an option to a choice/...
0
votes
2
answers
543
views
How to grant access to App permissions?
I am trying to access the SharePoint API with Python, a part of which involves bypassing Multi Factor Authentication using an app, following the instructions here: Setting up an app-only principal ...
1
vote
1
answer
3k
views
How to move a file from one folder to another through sharepoint api in python?
I have a folder in sharepoint. I wanted to move a file from one folder to another.
As per documentation, my trial was like below.
headers = {"Authorization" : "Barer" + Token,
...
0
votes
1
answer
4k
views
Convert the Powershell script to Python 3
I'm trying to perform an upload files from Linux to SharePoint using Python. However, I tried a lot by googling but nothing help. At last, I got a PowerShell script that is working. So requesting help ...
0
votes
1
answer
722
views
How to upload all files & sub directory in a directory to sharepoint
I'm writing an automation script to transfer files & subdirectory in a directory to SharePoint from ubuntu. And I'm able to transfer the files from in a directory but failed when uploading the ...
1
vote
0
answers
392
views
Python - Not able to access company share point directory which uses single sign on for authentication
My company share point uses windows authentication and uses HTTPS
I am trying to access company share point via the following code
import requests from requests_kerberos
import HTTPKerberosAuth, ...
0
votes
1
answer
388
views
How to create records in Sharepoint List using Display Name of columns, in Python REST?
I am trying to create new records (rows) in a Sharepoint List using a python script. I am specifying each record as a json containing the display names of columns/fields mapped to their respective ...
0
votes
1
answer
506
views
Excel file is not checked in after uploading to Sharepoint with Python
I have taken the following code from other post. This is very good and working fine.
import requests
from requests_ntlm import HttpNtlmAuth
session = requests.Session()
session.auth = HttpNtlmAuth('...
0
votes
1
answer
3k
views
Python requests post JSON raw data in SharePoint
I want to update some property in a SharePoint ListItem.
I'm using this code:
body = '{"__metadata": {"type": "SP.Data.Documentos_x0020_compartidosItem"}, "Tarea": "TP 15"}'
header = {'...
1
vote
2
answers
3k
views
How can I upload a document to a sharepoint subfolder using the REST API?
I'm using the official Office365-REST-Python-Client which basically is a wrapper to submit HTTP requests. I'm looking at the documentation and have been succesfully able to upload documents to the ...
2
votes
1
answer
719
views
Create a document library in a sharepoint online site with python
I am trying to create a document library with a python script.
I have tried doing it using Microsoft graph but I am having trouble doing with POST request and I didn't succeed.
I also tried doing so ...
0
votes
1
answer
831
views
Get the Last Modifying User of a file from the SharePoint web API
I am using python and want to make a simple request to get the last modifying user from the list of items in a document library. This is my code:
import sharepy
s = sharepy.connect("company....
1
vote
1
answer
4k
views
Not able to access content of sharepoint folders using shareplum [Python]
I've asked this question on stackoverflow too, here. But someone told me I'd have better luck on sharepoint stackexchange.
I'm trying to download a few csv files that reside in a document thats part ...