问题
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:-
- Use the revisions feed
- Use the changes feed
- For non-Google files, you can use the md5sum
- If you are happy to use the v2 API, you can use etag
- 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