Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sharepoint `Unsupported segment type` when checkin/chekout file

I'd like to use the checkout/checkin feature on the OneDrive REST API: https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_checkout

I'm facing two issues:

1st issue - the file info API returns publication property as published, even the file is manually checked out

Request:

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

Response:

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

enter image description here

2nd Issue - weird response of the checkout/checkin endpoint:

I'm using the endpoint as defined here https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_checkout

e.g. https://graph.microsoft.com/v1.0/sites/SITE_ID/drive/items/FILE_ID/checkout

Responds with:

{
    "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"
        }
    }
}

Any thought what I'm missing?

like image 866
vt. Avatar asked Feb 21 '18 09:02

vt.


1 Answers

The /checkin and /checkout endpoints are currently in beta.

Try changing your URI's root from https://graph.microsoft.com/v1.0/ to https://graph.microsoft.com/beta/:

https://graph.microsoft.com/v1.0/sites/{siteId}/drive/items/{itemId}/checkout
like image 153
Marc LaFleur Avatar answered Nov 08 '22 02:11

Marc LaFleur