Google drive modifiedTime changes after update response

此生再无相见时 提交于 2021-01-28 10:06:53

问题


I updated a file using the client API:

FilesResource.UpdateMediaUpload request;
request = Service.Files.Update(new Google.Apis.Drive.v3.Data.File(), id, stream);
request.Upload();

var Modified = request.ResponseBody.ModifiedTime;

I then requested for the same file after:

var modified = Service.Files.Get(id).Execute().ModifiedTime

These dates are milliseconds out of sync, i.e.:

modified.ticks = 636284845226980000

Modified.ticks = 636284845229162448

Modified.time - modified.time = 218ms

Why is this happening, and how can I rectify this?


回答1:


It's happening because the file meta data is being updated asynchronously and there is nothing you can do to rectify it because it isn't a fault.

If you explain why this causes you a problem, there may be an alternative approach. Eg:-

  1. Use the revisions feed
  2. Use the changes feed
  3. For non-Google files, you can use the md5sum
  4. If you are happy to use the v2 API, you can use etag
  5. Use the Properties feature to "tag" the file manually with an increment or timestamp


来源:https://stackoverflow.com/questions/43562875/google-drive-modifiedtime-changes-after-update-response

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!