0

I am making a custom web part that connects to the Documents list on SharePoint via Fetch. This is the call that I use for retrieving information:

/_api/web/lists/getByTitle('Documents')/items?$select=EncodedAbsUrl,*,File/Name&$expand=Folder&$expand=File

Right now I get mostly all the data that I need for all the items, but I just need to also have the URL that redirects you to the preview of the file Example of file preview

If possible, I don't want to make another fetch, So is there any item property that I could expand to get the preview URL, via REST API?

I checked the values of EncodedAbsUrl and ServerRedirectedEmbedUrl, but these are not exactly the preview URL that I have in mind.

I've seen a similar question to mine, even tho I don't need the same thing I've also tried expanding the fetch to recieve more data of vti_x005f but still, I couldn't find the preview URL

Similar Question

With this one: /_api/web/lists/getByTitle('Documents')/items?$select=EncodedAbsUrl,*,File/Name/Properties/vti_x005f_shortcuturl&$expand=Folder&$expand=File&$expand=Properties

Thank you in advance,

1 Answer 1

0
 /_api/web/lists/getbytitle('Documents')/items?$select=*,FileLeafRef,FileRef

then use for pdf or word

absoluteUrl + "/_layouts/15/WopiFrame.aspx?sourcedoc=" + FileRef + "&file=" +FileLeafRef + "&action=default"

for images

/sites/Development/Shared%20Documents/Forms/AllItems.aspx?id=/sites/Development/Shared Documents/lehladakh.jpg&parent=/sites/Development/Shared Documents
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.