Sharepoint API OData filter is not working

Naganathan Mathavan 0 Reputation points
2024-12-18T12:55:39.97+00:00

I am trying to get files from a specific folder(drive) in Sharepoint.

First, I am getting the DriveItem.

My Code:

string filter = $"tolower(Name) eq '{folderName.ToLower()}' and endswith(tolower(WebUrl),'{parentFolderPath.ToLower()}/{folderName.ToLower()}')";
DriveItemCollectionResponse driveItemCollectionResponse = await _graphClient.Drives[_driveId].Items.GetAsync(delegate (RequestConfiguration<ItemsRequestBuilder.ItemsRequestBuilderGetQueryParameters> reqConfig)
{
    reqConfig.QueryParameters.Filter = filter;
}, cancellationToken);
if (driveItemCollectionResponse != null && driveItemCollectionResponse.Value != null && driveItemCollectionResponse.Value.Count > 0)
{
    driveItem = driveItemCollectionResponse.Value.First();
}

It returns all the files and folders form the Sharepoint.  I have tested this code, and I am sure that the filter works. Application has been running in Live for a while.

From Dec 14, 2024, I see that the filter is not working. driveItemCollectionResponse contains all files and folders from Sharepoint site.

Are there any recent changes affecting these API?

I have created Github ticket, https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/2777

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,663 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,004 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,158 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 43,801 Reputation points
    2024-12-19T03:04:15.16+00:00

    Hi @Naganathan Mathavan

    This is an issue with the API. Starting this week, the filter for drive items seems to be broken.

    Please open a support ticket with Microsoft Support to get help from the API owner.

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.