I'm using Graph API, using example code in Graph API I'm able to upload file to OneDrive
.
GraphServiceClient graphClient = new GraphServiceClient(authProvider);
var stream = "The contents of the file goes here."
await graphClient.Me.Drive.Items["{item-id}"]
.Request()
.PutAsync(stream);
Question is, I want to include Description
to the uploaded file.
I don't know if this possible, but couldn't find info on it.
It depends whether OneDrive personal
or OneDrive for Business
/SharePoint document library
drive type is utilized.
From driveItem
resource type page
description
String
Provides a user-visible description of the item. Read-write. Only on OneDrive Personal
In case of OneDrive Personal, driveItem.Description
property could be updated like this:
//upload a file
var driveItem = await graphClient.Me.Drive.Items[itemId]
.Content
.Request()
.PutAsync<DriveItem>(stream);
//update driveItem
var updateItem = new DriveItem { Description = "File uploaded" };
await graphClient.Me.Drive.Items[driveItem.Id].Request().UpdateAsync(updateItem);