使用.NET更新Google云端硬盘上的文件内容

问题描述

我要在特定文件内容中添加文本。

我用过:

  var file = await dataService.Files.Get(fileId).ExecuteAsync();
  if (file == null)
  {
    throw new Exception(nameof(fileId));
  }

  using (var stream = new MemoryStream())
  {
    using (var sw = new StreamWriter(stream,Encoding.UTF8))
    {
      sw.Write(content); //there is a simple text like: bblablllbalblba

      var request = dataService.Files.Update(file,fileId,stream,file.MimeType);
      await request.UploadAsync();
    }
  }

,但似乎内容未更新/编写。我没有任何错误。

我错了吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)