0

I am having trouble locating the methods to "Check Out" (or otherwise lock) and "Check In" documents in a SharePoint Online library/list using the Graph SDK. I don't actually see the REST calls listed either, but I have to believe they are somewhere, because OneDrive for Business webclient exposes these functions.

Basically, in some version-control scenarios, SharePoint admins and/or designers can "Require Check Out" in the library's Versioning Settings configuration. Editing a document is then a multi-step process, one of the first steps is to "Check Out" the document from the library so it is locked for edits to the current user. I can not find this method (and the mirror method "Check In") in reviewing the REST docs or the Graph SDK source code on GitHub. These methods would be required if a library is configured to "Require Check Out".

I have looked through the (Graph)List and ListItem objects pretty thoroughly (including the Versions relationship/collection) and can not locate the methods. I would have expected them to be available on a ListItem object.

If anyone has any code to work with document ListItems in this manner - or simply knows where to find these methods, it would be very helpful.

AWeber
  • 381
  • 1
  • 3
  • 14

1 Answers1

2

Those operations are not supported per list items (and in fact never was in SharePoint APIs) but are supported for files in document libraries via DriveItem resource which:

represents a file, folder, or other item stored in a drive. All file system objects in OneDrive and SharePoint are returned as driveItem resources.

Documentation:

The following example demonstrates how to checkout a file in document library:

POST https://graph.microsoft.com/beta/sites/{site-id}/lists/{list-id}/items/{item-id}/driveItem/checkout

and check-in it:

POST https://graph.microsoft.com/beta/sites/{site-id}/lists/{list-id}/items/{item-id}/driveItem/checkin
Vadim Gremyachev
  • 57,952
  • 20
  • 129
  • 193
  • 1
    thank you for replying. Yes, I may have not been clear in my OP; I am aware that checkout/checkin operations are enabled on a per library basis (and therefore apply to all files in that library). However, I can't find the checkout and checkin methods/operations documented in here: https://learn.microsoft.com/en-us/graph/api/resources/driveitem?view=graph-rest-1.0 (thank you for your input). They are definitely not available in the Graph SDK. I will try to log an issue in GitHub for that. – AWeber Feb 11 '19 at 22:05
  • @AWeber, regarding the [link](https://learn.microsoft.com/en-us/graph/api/resources/driveitem?view=graph-rest-1.0), probably the reason why they are missing there is because those methods are available under under the `/beta` version only at the moment – Vadim Gremyachev Feb 12 '19 at 12:18
  • 1
    Yes, that is the feedback I got from one of the maintainers responding to my GitHub 'issue'. Strange that a function that has been part of SP for many versions is missing in the 1.0 release. Also strange that the MSFT OneDrive webclient is able to perform these functions...they must not be using their own Graph-REST API. – AWeber Feb 12 '19 at 14:15
  • 1
    We actually introduce APIs on Microsoft Graph in /beta first then onto v1.0. For OneDrive and SharePoint, because it has been around longer than Microsoft Graph, it has "direct endpoints" and eventually these either get channeled through the Microsoft Graph API or are re-written to be on Microsoft Graph (plenty of SOAP APIs out there that do not meet the API standards of Microsoft Graph). In some cases, the OneDrive apps use the direct APIs and not Microsoft Graph. Hope this helps a little with understanding. Typically things in /beta get promoted to v1.0 within 6-9 months. – Jeremy Thake MSFT Feb 12 '19 at 18:20
  • Thank you Jeremy for the details! Look forward to getting more pieces in place with Graph API/SDK!!! – AWeber Feb 14 '19 at 20:50
  • Where is "discard checkout" operation? – 23W Jul 26 '21 at 20:12