MS Graph SDK .NET get all items from a SharePoint library, even if checked out

Viewed 147

I try to get all items from a SharePoint library, regardless of its status (checkin/out). Why does my code don't get the checked out items/documents

graphClient.Sites["SITEID"].Lists["LISTID"].Items.Request().Expand("createdByUser,fields,driveItem").GetAsync().Result;

Edit:

  • Versioning is on
  • If entry is first version and checked out, it will not be displayed
  • If there are several versions, the versions before last is displayed (level = published)
1 Answers

driveItem resource has publication property which provides information about the published or checked-out state of an item, in locations that support such actions.

This property is not returned by default.

You have to add $select statement to driveItem in Expand method.

graphClient.Sites["SITEID"]
    .Lists["LISTID"]
    .Items
    .Request()
    .Expand("createdByUser,fields,driveItem($select=publication)")
    .GetAsync().Result;

PublicationFacet has property level which describes the state of publication for document. Either published or checkout.

Resources:

driveItem

publicationFacet

Related