I want to list all items from a Sharepoint Document Library as shown below:
var dokumenteId = "The Id of the document library";
var options = new TokenCredentialOptions
{
AuthorityHost = AzureAuthorityHosts.AzurePublicCloud
};
var clientSecretCredential = new ClientSecretCredential(_tenantId, _clientId, _clientSecret, options);
var scopes = new[] { "https://graph.microsoft.com/.default" };
GraphClient = new GraphServiceClient(clientSecretCredential, scopes);
var drive = await GraphClient
.Drives[dokumenteId]
.Items
.GetAsync(); //this line throws the exception
On execution the Code throws the following exception
The ‘filter’ query option must be provided.
is thrown. When looking into the documentation here, ‘filter’ was not mentioned. However, the example left me a bit confused
var result = await graphClient.Drives["{drive-id}"].Items["{driveItem-id}"].Children.GetAsync();
As it would mean, I need to pass the driveItem-id
parameter, which, when parsing the root folder does not make sense.
How can I get a list of the items (folders and files) in a sharepoint library (i.e drive) that sits directly in the site?