question

JatishKhanna-5917 avatar image
0 Votes"
JatishKhanna-5917 asked 35247258 edited

Graph API - Fetch Thumbnail with request option - response with ?select param

Adding a "select" request option to the Graph API - doesn't behave as same as HTTP request.

   LinkedList<Option> requestOptions = new LinkedList<Option>();
   requestOptions.add(new QueryOption("select", "c300x400_crop"));
     return graphClient.drives(getResourceDriveId())
             .items(getitemId())
             .thumbnails()
             .buildRequest(requestOptions)
             .get();


Actual Response body

 {
   "nextPage": null,
   "currentPage": [
     {
       "oDataType": null,
       "id": null,
       "large": null,
       "medium": null,
       "small": null,
       "source": null
     }
   ],
   "count": null
 }


Expected Response:

  HTTP/1.1 200 OK
 Content-Type: application/json
    
 {
   "value": [
     {
       "id": "0",
       "c300x400_crop": { "height": 300, "width": 400, "url": "https://sn3302files.onedrive.com/123"},
     }
   ]
 }


Document Details


Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

microsoft-graph-files
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered

Hi @JatishKhanna-5917,

I did a test in graph explorer to send the request, the response works well there.

I am not familiar with JAVA, but I could get the similar result as yours when testing in C# app.

You could try to change your code like this:

 ThumbnailSetCollectionPage thumbnails = graphClient.drives(getResourceDriveId())
              .items(getitemId())
              .thumbnails()
              .buildRequest(requestOptions)
              .get();
 return  thumbnails[0].AdditionalData 



If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.