【问题标题】:Sharepoint `Unsupported segment type` when checkin/chekout file签入/签出文件时的Sharepoint`不支持的段类型`
【发布时间】:2018-02-21 09:23:27
【问题描述】:

我想使用 OneDrive REST API 上的结帐/签入功能https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_checkout

我面临两个问题:

第 1 期 - 文件信息 API 将 publication 属性返回为 published,即使文件是手动签出的

请求:

https://graph.microsoft.com/v1.0/sites/SITE_ID/drive/items/FILE_ID?select=name,id,publication

回复:

{
    "id": "01KJOOXJHF77OPSR7HWVCKSTHBQJQZEBJI",
    "name": "diamond.mmap",
    "publication": {
        "level": "published",
        "versionId": "2.0"
    }
}

第 2 期 - 结帐/签入端点的奇怪响应:

我正在使用此处定义的端点 https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_checkout

例如 https://graph.microsoft.com/v1.0/sites/SITE_ID/drive/items/FILE_ID/checkout

回复:

{
    "error": {
        "code": "BadRequest",
        "message": "Unsupported segment type. ODataQuery: sites/fe688d8ed4a2/drive/items/01KJOQZEBJI/checkout",
        "innerError": {
            "request-id": "a7d18555-3e74-4aea-ad92-539481f6c33b",
            "date": "2018-02-21T09:17:00"
        }
    }
}

有没有想过我错过了什么?

【问题讨论】:

    标签: rest sharepoint microsoft-graph-api onedrive


    【解决方案1】:

    /checkin/checkout 端点当前位于 beta

    尝试将 URI 的根从 https://graph.microsoft.com/v1.0/ 更改为 https://graph.microsoft.com/beta/

    https://graph.microsoft.com/v1.0/sites/{siteId}/drive/items/{itemId}/checkout
    

    【讨论】:

    • beta 抛出 "code": "-1, Microsoft.SharePoint.Client.UnknownError", "message": "Unknown Error", :(
    • https://graph.microsoft.com/beta/drives/DRIVE_ID/items/ITEM_ID 正确获取文件信息
    • 我可以通过标准身份验证使用 Sharepoint API (docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/…) 签出文件(我从浏览器获取 cookie 来验证签出请求)。但是,我需要使用 OAuth。哪些身份验证端点与 Sharepoint API 兼容?
    • https://login.microsoftonline.com/common/oauth2/v2.0/authorize 获取的访问令牌不起作用
    • @marc-lafleur /checkin /checkout 端点在官方文档中提到:docs.microsoft.com/en-us/onedrive/developer/rest-api/api/… 没有提及“Beta”。此外,我们尝试了betav1.0 端点,但均未成功。您知道这是否是 Microsoft 的一个已知问题?
    猜你喜欢
    • 2014-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-26
    相关资源
    最近更新 更多