How can I create file URL of a document in SharePoint Document library using CSOM

Copper Contributor

Hi All,

 

I have a file(say abc.docx) in SharePoint Online Document Library and I want to create a url so that I can share the same with other users. Once they click on the url, the file will open in word online. Similar to the url in attached snapshot(FileUrl_inSPOnline.png). I am using CSOM and I have following info:

1. SharePoint site.

2. Document library name

3. File Name and item ID.

4. SharePoint properties of the file(attached SharePoint_document_properties.docx, the file properties are of a different than the one in snapshot).

 

https://emc13.sharepoint.com/sites/VidyaSiteBasedLogging/SP_Document_library/Document.docx?d=w2e220c3fc5874ae1a5427d7b2cc58bfe

The query string in the above url is "w" + "UniqueId".  UniqueId is SharePoint document property & its a GUID. 

The only issue is  the extra "w". What is this extra "w" and can this be used for all documents?

Also Please let us know if there is any other better way to create a open/edit/share url of a SharePoint document.

 

Thanks.

 

 

1 Reply