0

Microsoft Graph REST API indicates that when updating the properties of an existing DriveItem, only the properties that are to be updated should be passed in the method. This does not seem to work in the C# SDK v1.13.

Using the .Net SDK, the IDriveItemRequest.UpdateAsync() method calls for a DriveItem parameter. I am populating a new DriveItem object with only the properties I want to change: Description, for example, since the IDriveItemRequest has been explicitly created for the DriveItem I wish to update.

The UpdateAsync() call with my partial/delta DriveItem returns the original DriveItem, unchanged. (I have verified that I have Read/Write access to the file.)

string myID = existingItem.Id;

DriveItem updater = new DriveItem();
updater.Description = "Changed Description";

DriveItem updatED = await graphClient.Me.Drive.Items[myID].Request().UpdateAsync(updater);

I would expect the returned DriveItem object ("updatED" in above code example) would be my existingItem DriveItem, updated with the Description = "Changed Description". Further, the DriveItem's LastModifiedDate would likely be "Now".

The call returns the original DriveItem - not updated.

So what is the .Net UpdateAsync method looking for as a parameter? The REST SDK pages indicate it should only be what is being explicitly updated.

Thanks.

Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
AWeber
  • 381
  • 1
  • 3
  • 14
  • FWIW: It _may_ _be_ that you can't update "Description" in particular. In fact, I can't find Description in the OneDrive web client anywhere for a file (I am testing in OneDrive Business). The DriveItem has a Description property, and it is used in a number of examples, but I can't find it stored anywhere. Is this property "real" and persistent? – AWeber Jan 25 '19 at 02:26
  • 1
    According to the docs here https://learn.microsoft.com/en-us/graph/api/resources/driveitem?view=graph-rest-1.0#properties you can only update the description property in OneDrive Personal – Darrel Miller Jan 25 '19 at 05:21
  • @DarrelMiller thanks, I totally missed that in the docs. Poor RTFM on my part. Wonder why Personal allows for the extra property and not Business? Anyway, I will use your info and mark it answered. Thank you. – AWeber Jan 25 '19 at 13:08

0 Answers0