Questions tagged [python]
The python tag has no usage guidance.
37
questions
0
votes
0
answers
115
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
0
answers
22
views
The security validation for this page is invalid. when adding a file to a folder
I'm using the python office365 library and am repeatedly coming up against the same problem, encapsulated below where I'm trying to add a file:
After setting the site url, folder etc., this is the ...
0
votes
0
answers
9
views
Migrating Database from MySQL Workbench to SharePoint List for Python Flask Application
We are new to this site and request your kind support in solving our query.
We have a created python flask based web application wherein we have used MySQL WorkBench as a database.
Now, we have been ...
0
votes
2
answers
189
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
632
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
0
answers
11
views
Schedule Jobs offline for sharepoint files
I am currently working on the files that are in the sharepoint . So basically connect to sharepoint via python and then do some manipulation and then the output files generated to be stored back in ...
0
votes
1
answer
401
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")....
0
votes
0
answers
74
views
Unable to post messages on Teams using Micros
Getting the following error while running the python code:
{"error":{"code":"Unauthorized","message":"Message POST is allowed in application-only context ...
0
votes
0
answers
66
views
Sharepoint Query returns no results for with >5000 items
When I go to a specific folder in Sharepoint, I hit an error that I have exceeded the view threshold of 5000 items. I created a new view to only show items when the ID < 5000, I am able to see the ...
1
vote
0
answers
778
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
194
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
899
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
630
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',...
0
votes
1
answer
432
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
623
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
912
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
125
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
930
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
295
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
57
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
23
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
186
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
470
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
2k
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
3k
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
605
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
348
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
327
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
479
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
2k
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
649
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
705
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 ...