Forum Discussion
iainmac
Jul 01, 2019Copper Contributor
SharePoint 365 Rest API: Add a link item in a document library
Hi I am looking into creating a new link item in a document library using rest api. I have looked around and can not find a solution as yet. Has anyone managed to achieve this? Many thank...
PatrickBeauperin
Sep 15, 2021Copper Contributor
Hi iainmac,
Found a way to do that in REST.
POST https://<tenant>.sharepoint.com/sites/<yoursite>/_api/web/GetFolderByServerRelativeUrl('TestLib')/Files/add(url='LinktoFolder.url',overwrite=true)
Headers
{
"content-type": "text/plain",
"accept": "application/json"
}
Body (in plain text as is shown below)
[InternetShortcut]
URL=https://<tenant>.sharepoint.com/sites/<anysite>/linkToFile