0

I can preview a document in sharepoint by hitting /sites/sitename/_layouts/15/WopiFrame2.aspx?sourcedoc={GUID}&action=view&wdSmallView=1

I know I can also get the preview by just placing the file name between the brackets, but is it possible to get the GUID for this link with the file name, or some other file property?

0

See if this is the GUID you are looking for.

This example is using the ID property, but any retrieval should work.

/sites/yourSite/_api/web/lists/getbytitle('Documents')/Items/GetById(1)?$select=id

Returned JSON (GUID is in the metadata section)

{
    "odata.metadata": "https://yourServer/sites/yourSite/_api/$metadata#SP.ListData.Shared_x0020_DocumentsItems/@Element&$select=id",
    "odata.type": "SP.Data.Shared_x0020_DocumentsItem",
    "odata.id": "9b85f08e-1484-43f0-be5d-83861ca77415",
    "odata.etag": "\"22\"",
    "odata.editLink": "Web/Lists(guid'c8612335-fb7e-4edf-bf1d-b9186a8b987b')/Items(1)",
    "Id": 1,
    "ID": 1
}
  • When I hit that endpoint, I didn't get a metadata section. I think I will modify my question to specify which GUID I am looking for. – Jeremy J Oct 26 '18 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.