Use 50% Discount for all private proxies!
Unlimited possibilities with ExtraProxies

how to upload a file to a document library using OData in PowerShell with curl or Invoke-RestMehthod

As I cannot use Pnp.PowerShell with a SharePoint-2019 on premise, AFAIK, I’ve been trying to do it with OData using curl. Unfortunately it happens to be much more complicated than I thought.

I ended up building this command:

curl -vvv -n -X POST  "'/site/aaa/library/folder')/Files/add" -T a.xlsx -H "Accept: application/json;odata=nometadata" -H "X-RequestDigest: xxxxxx" 

HTTP/1.1 400 Bad Request


curl -vvv -n -X POST  "'/site/aaa/library/folder')/Files/add(url=a.xlsx,overwrite=true)" -T a.xlsx -H "Accept: application/json;odata=nometadata" -H "X-RequestDigest: xxxxxx" 


{"odata.error":{"code":"-2130575252, System.Runtime.InteropServices.COMException","message":{"lang":"fr-FR","value":"La validation de la sécurité de cette page a expiré. Cliquez sur Précédente dans votre navigateur web, actualisez la page et retentez l’opération."}}}* Connection #0 to host left intact

I found this PowerShell function: Upload-FileToShp, but I cannot make it work in my case, so doesn’t help for having a correct curl or Invoke-RestMethod!

WHat’s missing?

Related Posts
DreamProxies 100 Proxies 200 Proxies 400 Proxies 1000 Proxies 2000 Proxies 5000 Proxies 10000 Proxies

Garuda138 Ajaib88 Asia77

Ganas69 Uber77 Gacor77