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

%3CLINGO-SUB%20id%3D%22lingo-sub-715934%22%20slang%3D%22en-US%22%3EHow%20can%20I%20create%20file%20URL%20of%20a%20document%20in%20SharePoint%20Document%20library%20using%20CSOM%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-715934%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20file(say%20abc.docx)%20in%20SharePoint%20Online%20Document%20Library%20and%20I%20want%20to%20create%20a%20url%20so%20that%20I%20can%20share%20the%20same%20with%20other%20users.%20Once%20they%20click%20on%20the%20url%2C%20the%20file%20will%20open%20in%20word%20online.%20Similar%20to%20the%20url%20in%20attached%20snapshot(FileUrl_inSPOnline.png).%26nbsp%3BI%20am%20using%20CSOM%20and%20I%20have%20following%20info%3A%3C%2FP%3E%3CP%3E1.%20SharePoint%20site.%3C%2FP%3E%3CP%3E2.%20Document%20library%20name%3C%2FP%3E%3CP%3E3.%20File%20Name%20and%20item%20ID.%3C%2FP%3E%3CP%3E4.%20SharePoint%20properties%20of%20the%20file(attached%20SharePoint_document_properties.docx%2C%20the%20file%20properties%20are%20of%20a%20different%20than%20the%20one%20in%20snapshot).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Femc13.sharepoint.com%2Fsites%2FVidyaSiteBasedLogging%2FSP_Document_library%2FDocument.docx%3Fd%3D%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Femc13.sharepoint.com%2Fsites%2FVidyaSiteBasedLogging%2FSP_Document_library%2FDocument.docx%3Fd%3D%3C%2FA%3E%3CSTRONG%3Ew%3C%2FSTRONG%3E2e220c3fc5874ae1a5427d7b2cc58bfe%3C%2FP%3E%3CP%3EThe%20query%20string%20in%20the%20above%20url%20is%20%22w%22%20%2B%26nbsp%3B%22UniqueId%22.%26nbsp%3B%20UniqueId%20is%20SharePoint%20document%20property%20%26amp%3B%20its%20a%20GUID.%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20only%20issue%20is%26nbsp%3B%20the%20extra%20%22w%22.%20What%20is%20this%20extra%20%22w%22%20and%20can%20this%20be%20used%20for%20all%20documents%3F%3C%2FP%3E%3CP%3EAlso%20Please%20let%20us%20know%20if%20there%20is%20any%20other%20better%20way%20to%20create%20a%20open%2Fedit%2Fshare%20url%20of%20a%20SharePoint%20document.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-718827%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20I%20create%20file%20URL%20of%20a%20document%20in%20SharePoint%20Document%20library%20using%20CSOM%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-718827%22%20slang%3D%22en-US%22%3E%3CP%3EI%20got%20a%20similar%20link%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FSharePoint%2FGetting-Link-to-a-Document-with-Modern-Document-Libraries%2Fm-p%2F5099%23M306%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FSharePoint%2FGetting-Link-to-a-Document-with-Modern-Document-Libraries%2Fm-p%2F5099%23M306%3C%2FA%3E.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20url%20I%20am%20going%20to%20use%20is%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Femc13.sharepoint.com%2Fsites%2FVidyaSiteBasedLogging%2FSP_Document_library%2FDocument.docx%3Fweb%3D1%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSHAREPOINT%20tenant%3D%22%22%3E%2F%3CSITE%20relative%3D%22%22%20url%3D%22%22%3E%2F%3CSHAREPOINT%20document%3D%22%22%20library%3D%22%22%3E%2F%3CSHAREPOINT%20document%3D%22%22%20title%3D%22%22%3E%3Fweb%3D1%3C%2FSHAREPOINT%3E%3C%2FSHAREPOINT%3E%3C%2FSITE%3E%3C%2FSHAREPOINT%3E%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New 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