I'm trying to rewrite this code so that it will work with the version 5.0 of the Microsoft Graph .NET SDK:
private async static Task<DriveItem> UploadSmallFile(string driveId, string filePath, MemoryStream fileStream)
{
var queryOptions = new List<QueryOption>()
{
new QueryOption("@microsoft.graph.conflictBehavior", "replace"),
};
DriveItem file = await GraphClient
.Drives[driveId]
.Root
.ItemWithPath(filePath)
.Content
.Request(queryOptions)
.PutAsync<DriveItem>(fileStream);
return file;
}
The following code creates a file but does not return the DriveItem since the PutAsync as a void function (Task). I'm also unclear about how I can pass the conflictBehavior as "replace".
await GraphClient
.Drives[driveId]
.Root
.ItemWithPath(filePath)
.Content
.PutAsync(fileStream);
Any help is appriciated.