I am trying to retrieve Images from Image Library using Rest API from a mobile device (hence, no cross site calls)..

I am using this approach (https://stackoverflow.com/questions/16893729/how-to-retrieve-image-files-from-sharepoint-image-library-list-through-rest-ap ) to get file binaries directly, not the server relative URL to avoid cross site requests.

I am able to get the images, however since I want to create a picture gallery on my phone, I want to download thumbnails first and then full image once you click on thumbnail.

Is there any way to get thumbnails using Rest API?

2 Answers 2


It seems SharePoint generates thumbnail file name using the following format:

thumbnailUrl = <filename>_<fileextension>.jpg 

Based on that, the following REST endpoint shows to get thumbnail file content:



var webUrl = "https://tenant.sharepoint.com";
var fileUrl = "/PublishingImages/sample.png";

var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);

var requestUrl = String.Format("{0}/_api/web/getfilebyserverrelativeurl('{1}')/$value",webUrl,GetThumbnailUrl(fileUrl));
var response = client.GetAsync(requestUrl, HttpCompletionOption.ResponseHeadersRead).Result;
var fileContent = response.Content.ReadAsByteArrayAsync().Result;


public static string GetThumbnailUrl(string fileUrl)
    return System.IO.Path.GetFileNameWithoutExtension(fileUrl) + "_" + System.IO.Path.GetExtension(fileUrl) +".jpg";


Probably the better option would be to get image thumbnail url via EncodedAbsThumbnailUrl property:

  • Get image thumbnail url using request: /_api/web/lists/getbytitle('<image library title>')/items(<item id>)?$select=EncodedAbsThumbnailUrl
  • then request thumbnail file content: /_api/web/getfilebyserverrelativeurl('{thumbnailUrl}')/$value
  • 2
    For getting file names you could utilize the following request: /_api/web/lists/getbytitle('Images')/items?$select=FileRef Oct 23, 2015 at 7:27
  • 1
    Thanks a lot @Vadim, your answer lead me to the right track. Thanks again
    – Rahul
    Oct 23, 2015 at 10:41
  • System.IO.Path.GetExtension(fileUrl) +".jpg" your are adding extension two times ? Oct 31, 2018 at 7:38
  • 1
    No, it is System.IO.Path.GetFileNameWithoutExtension(fileUrl) Oct 31, 2018 at 7:43
  • 1
    sorry. i got it wrong Nov 1, 2018 at 12:51

SharePoint generates thumbnail file name using the following format:

thumbnailUrl = <fileFolder>/_t/<filename>_<fileExtension>.jpg 

So for the file MainLibrary/Tables/Table01.pptx it will be MainLibrary/Tables/_t/Table01_pptx.jpg

In my case I have url:


So I can get file by this link:


Your Answer

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

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