Posts

Showing posts with the label SharePoint Rest Api

Quirks of uploading aspx files to a document library using SharePoint REST API

Uploading a file to a SharePoint document library using the SharePoint REST API can be very straight forward. Fast forward to  Microsoft Docs  and you are presented with all the information you need. A simple construct: Create a file and add it to a folder url : http : //site url/_api/web/GetFolderByServerRelativeUrl('/Folder Name')/Files/add(url='a.txt',overwrite=true) method : POST body : "Contents of file" Headers : Authorization : "Bearer " + accessToken X - RequestDigest : form digest value content - length : length of post body Update a file by using the PUT method url : http : //site url/_api/web/GetFileByServerRelativeUrl('/Folder Name/file name')/$value method : POST body : "Contents of file." Headers : Authorization : "Bearer " + accessToken X - RequestDigest : form digest value X - HTTP - Method : "PUT" content - length : length of post b