同一文件的 MS Graph lastModifiedDateTime 和 SharePoint REST API TimeLastModified 不同

问题描述 投票:0回答:1

我使用 Web 界面将文件上传到用户的 OneDrive,然后使用两个 API 获取文件信息:MS Graph API 和 SharePoint REST API。

对于 MS Graph API 我使用了以下端点:

https://graph.microsoft.com/v1.0/drives/b{drive-id}/items/{item-id}

我得到的答复:

{
    ***
    "createdDateTime": "2019-12-09T15:03:52Z",
    "eTag": "\"{9E8670D4-185F-4E8D-B2E5-61819E769BC3},2\"",
    "lastModifiedDateTime": "2019-12-09T15:04:12Z",
    "name": "test.psd",
    "cTag": "\"c:{9E8670D4-185F-4E8D-B2E5-61819E769BC3},2\"",
    "size": 56783858,

    "lastModifiedBy": {
        "user": {
            "email": "[email protected]",
            "id": "6e14d588-63db-46e4-b70d-0f00050dafa4",
            "displayName": "Batman"
        }
    },
    "fileSystemInfo": {
        "createdDateTime": "2019-12-09T15:03:52Z",
        "lastModifiedDateTime": "2019-12-09T15:04:12Z"
    },
    ***
}

对于 SharePoint REST API 我使用了端点:

https://*my.sharepoint.com/personal/*/_api/Web/GetFileByServerRelativePath(decodedurl='*/test.psd')

我得到的回复:


        "LinkingUrl": "",
        "MajorVersion": 1,
        "MinorVersion": 0,
        "Name": "test.psd",
        "ServerRelativeUrl": "/*/test.psd",
        "TimeCreated": "2019-12-09T15:03:52Z",
        "TimeLastModified": "2019-12-09T15:04:11Z",
        "Title": null,
        "UIVersion": 512,
        "UIVersionLabel": "1.0",
        "UniqueId": *
}

API返回的修改时间为:

  • MS图:2019-12-09T15:04:12Z

  • SharePoint REST API:2019-12-09T15:04:11Z

    如您所见,它们相差 1 秒。有人可以解释一下为什么我会看到这样的差异吗?

microsoft-graph-api onedrive sharepoint-rest-api
1个回答
0
投票

我的第一个想法是FileSystemInfo是从文件元数据导入的,而DriveItem上的lastModified是Graph信息。

一秒的延迟可能是请求和响应之间的间隔,这与上面提到的差异有关。

如果这是一个问题,我只会选择其中之一。

© www.soinside.com 2019 - 2024. All rights reserved.