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

Jatish Khanna 1 Reputation point
2021-08-06T10:38:54+00:00

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 learn.microsoft.com ➟ GitHub issue linking.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,445 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MichaelHan-MSFT 18,026 Reputation points
    2021-08-09T08:44:11.547+00:00

    Hi @Jatish Khanna ,

    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.

    0 comments No comments