dev.Manderson
dev.Manderson

Reputation: 85

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

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:

Upvotes: 1

Views: 599

Answers (1)

user2250152
user2250152

Reputation: 20595

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

Upvotes: 2

Related Questions