microsoftgraph / microsoftgraph/msgraph-sdk-dotnet
Set thumbnail API for DriveItem missing
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 789
- Forks
- 264
- Avg merge
- 15h 17m
- Merged PRs (30d)
- 3
Description
Describe the bug
While there are hacks like #1630 to somehow get to most endpoints I have yet to figure out a hack to upload a thumbnail for a driveitem/album.
I have tried posting ThumbnailSet and just Thumbnails (as there are builders like graphClient.Drive.Items["id"].Thumbnails["0"]; ) but these all return not valid endpoints.
the microsoft documentation on setting thumbnails is near non-existent. It talks about thumbnail endpoints being usable for uploading a custom thumbnail item but doesn't give any URI: https://learn.microsoft.com/en-us/graph/api/driveitem-list-thumbnails?view=graph-rest-beta&tabs=http "Upload a custom thumbnail for an item"
This is about the closest I have gotten:
var r = graphClient.Drives[MeDriveId].Items[item.Id].Thumbnails["0"];
var getInfo = r.ToGetRequestInformation();
getInfo.HttpMethod = Method.PUT;
getInfo.URI = new Uri(getInfo.URI.ToString() + "/source/content");
getInfo.SetStreamContent(out_stream);
getInfo.Content =out_stream;
getInfo.Headers.Add("Content-Length", out_stream.Length.ToString());
var res = await graphClient.RequestAdapter.SendAsync<Thumbnail>(getInfo, factory: Thumbnail.CreateFromDiscriminatorValue);
It hits a valid endpoint but it never sends any data and I have to set the content length manually. The only documentation that talks about the set urls is: https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_put_thumbnailset_content?view=odsp-graph-online
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the DriveItem thumbnail request-builder path shown in the issue, then compare it with the Microsoft Graph thumbnail-setting documentation and the linked OneDrive endpoint. Reproduce the PUT request and verify that the SDK sends the thumbnail stream without manual URI, content, or Content-Length workarounds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100