I am using REST with SPOL and I am trying to get a image from a image doc. The way I would usually do it works fine for me because I am using a relative url to the picture.

The ways I usually do this

imgUrl = "https://tenant.sharepoint.com/sites/testSite/_api/web/GetFileByServerRelativeUrl('/sites/ContentCenter/docLib/" + spItems[z].text + "." + spItems[z].fileType + "')/$value";

However, I am trying to switch from this because List Id's are better to reference for accuracy. So I am trying to construct the url I am trying to use. I am using this however I am not able to get the image. I just get the item properties, unlike when I use value.

Not working

"https://tenant.sharepoint.com/sites/testSite/_api/web/lists/getbytitle('docLib')/Items?$filter=ID eq '79'&$value";

1 Answer 1


After using some Fiddler this was the url that worked for me

imgUrl = "https://tentant.sharepoint.com/sites/testSite/_api/web/lists/getbytitle('docLib')/items('79')/File/$value";

Your Answer

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

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