microsoftgraph / microsoftgraph/msgraph-sdk-dotnet

Unable to update fields of driveitem using '.ItemWithPath(documentSetName).PatchAsync(driveItem)'

Open
#2,851 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Status: Needs investigation
Dominant language
C#
Stars
789
Forks
264
Avg merge
15h 17m
Merged PRs (30d)
3

Description

I am trying to update SharePoint's DocumentSet metadata using below code, the call returns 200OK, but nothing is updated. What is wrong with the below code?

var driveItem = new DriveItem
{
    Name = "test01",
    ListItem = new ListItem
    {
        Fields = new FieldValueSet
        {
            AdditionalData = new Dictionary<string, object>
            {
                {
                    "CompanyCode" , "test01"
                },
                {
                    "CaseStatus" , "InProgress"
                }
            }
        }                    
    }
};

GetGraphClient().Drives[driveId].Root.ItemWithPath(documentSetName).PatchAsync(driveItem);

Note:

  • I have read that it is possible to do this update using lists[listID]/items[itemID], this approach requires 2 calls, first call to get the ItemId, subsequent to update - this would cause performance issues when there many documentsets to be updated.
  • In Graph SDK 3.4 version it was possible to update fields using .ListItem.Fields.Request().UpdateAsync - the SDK version 5.7 does not have similar capability.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the provided Drives[driveId].Root.ItemWithPath(documentSetName).PatchAsync entry point and compare it with the lists[listID]/items[itemID] approach described in the issue. Reproduce the request with the shown DriveItem payload, inspect the response and resulting fields, and determine whether SDK 5.7 supports this update path. Done means the supported update route or limitation is clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.