1
votes

With the help of the Microsoft Graph SDK for .NET, I want to enumerate all document libraries in my root site (eg http://mydomain.sharepoint.com) and for each one of them, enumerate their column definitions.

As I need the columns, I cannot use the query "/sites/{site-id}/drives" as it will return Drive object which do not have any columns. So the only way I found to perform this is to query all lists with a filter for the template property set to 'documentLibrary' according to the API reference : https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/list

In the graph explorer, the appropriate query seems to be : "https://graph.microsoft.com/v1.0/sites/root/lists?$filter=list/template eq 'documentLibrary'" but it sends back an error (same without the ' around documentLibrary). But I did not find any way to do this, neither with the .NET SDK nor the graph explorer.

Any help is welcome, thank you in advance

C# Method to request lists with the template filter

1

1 Answers

1
votes

Graph API on SharePoint list do not support filtering or ordering results. When Microsoft Graph sees a query parameter it doesn't expect, it simply ignoring the unknown filter parameter and returning us an unfiltered result; or it just return the none-supported tips. The list api supports the $expand, $select OData query parameters to customize the response.

With select and expand statements, you can retrieve list metadata, column definitions, and list items in a single request.

And the currently available documentation just states:

Support for $filter operators varies across Microsoft Graph APIs.

The word varies is the inference that these options are not totally supported across all products.

So if you request v1.0/sites/root/lists?$filter=list/template eq 'documentLibrary' you will get the following response message:

"message": "The provided filter statement is not supported"

You need to change your design on this. Meanwhile, you can vote up the existing feature request in User Voice or submit a new one.