I’m using Microsoft.SharepointOnline.CSOM
nugget and I can upload files withput any problems but if I change to ExecuteQueryAsync()
method seems to be notworking. Simply program fails without any exception.
Code Example
FileCreationInformation fileCreation = new FileCreationInformation()
{
ContentStream = new System.IO.MemoryStream(System.IO.File.ReadAllBytes(file.SourceFilePath)),
Overwrite = true,
Url = file.FileName
};
var uploadFile = folder.Files.Add(fileCreation);
_clientContext.Load(uploadFile);
await _clientContext.ExecuteQueryAsync();
Same code using ExecuteQuery()
is working properly.