microsoftgraph / microsoftgraph/msgraph-sdk-dotnet

Graph client query using filter on SharePoint folder name stopped working (as from 11 Feb 2025)

Open
#2,846 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Needs: Attention :wave: type:bug
Dominant language
C#
Stars
789
Forks
264
Avg merge
15h 17m
Merged PRs (30d)
3

Description

Describe the bug

Using a graph client query to get a SharePoint folder information by folder name stopped working. It has been working for months until February 11, 2025. (code block below)

folderSearch = await _graphClient.Drives[driveId]
                                 .Items
                                 .GetAsync(requestConfig => requestConfig.QueryParameters.Filter = $"Name eq '{folderName}'");

It returned the error:
Microsoft.Graph.Models.ODataErrors.ODataError: Filtering non-fields properties other than parentReference/id eq {value} is not supported.

Updating Microsoft Graph nuget package to the latest stable did not solve this issue.

Expected behavior

Until Feb 11, 2025 it returned a DriveItemCollectionResponse. In the folderSearch query driveId and foldername are the parameters from the called method.

How to reproduce

Use the following on a SharePoint Site:

        public async Task<DriveItem> GetFolderByFolderName(string driveId, string folderName)
        {
            DriveItemCollectionResponse folderSearch = null;
            DriveItem folder = null;

            folderSearch = await _graphClient.Drives[driveId]
                                             .Items
                                             .GetAsync(requestConfig => requestConfig.QueryParameters.Filter = $"Name eq '{folderName}'");
            bool folderIsNull = folderSearch == null || folderSearch.Value == null || folderSearch.Value.Count == 0;
            if (!folderIsNull)
                folder = folderSearch.Value[0];

            if (folderIsNull)  // folder does not exist yet, create it
            {
                DriveItem newFolderDriveItemPostRequest = new DriveItem
                {
                    Name = folderName,
                    Folder = new Folder { },
                    AdditionalData = new Dictionary<string, object>
                      {
                          {
                              "@microsoft.graph.conflictBehavior" , "fail"
                          },
                      },
                };
                DriveItem newFolderDriveItem = null;
                newFolderDriveItem = await _graphClient.Drives[driveId]
                                                       .Items
                                                       .PostAsync(newFolderDriveItemPostRequest);
                if (newFolderDriveItem != null)
                {
                    folder = newFolderDriveItem;
                    _logger.LogInformation($"Successful folder creation. folderName: {folderName}, folderId: {newFolderDriveItem.Id}");
                }
            }

            return folder;
        }
SDK Version

5.70.0

Latest version known to work for scenario above?

5.69.0 until date 2025-02-11

Known Workarounds

No response

Debug output

fail: Microsoft.Extensions.Hosting.Internal.Host[9]
BackgroundService failed
Microsoft.Graph.Models.ODataErrors.ODataError: Filtering non-fields properties other than parentReference/id eq {value} is not supported.
at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.ThrowIfFailedResponseAsync(HttpResponseMessage response, Dictionary2 errorMapping, Activity activityForAttributes, CancellationToken cancellationToken) at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory1 factory, Dictionary2 errorMapping, CancellationToken cancellationToken) at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory1 factory, Dictionary2 errorMapping, CancellationToken cancellationToken) at Microsoft.Graph.Drives.Item.Items.ItemsRequestBuilder.GetAsync(Action1 requestConfiguration, CancellationToken cancellationToken)
at SignalsStatisticsOverviewExportMSGraph.SharePointAccess.GetFolderByFolderName(String driveId, String folderName) in C:\Projects\SLS\Projects\SLSSignalsStatisticsExportService_Trunk\SLSSignalsStatisticsExportService\SignalsStatisticsOverviewExportMSGraph\SharePointAccess.cs:line 58
at SignalsStatisticsOverviewExportMSGraph.Worker.ExecuteAsync(CancellationToken stoppingToken) in C:\Projects\SLS\Projects\SLSSignalsStatisticsExportService_Trunk\SLSSignalsStatisticsExportService\SignalsStatisticsOverviewExportMSGraph\Worker.cs:line 41
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)

Configuration
  • OS: Windows 11 / Windows Server 2022 Datacenter (21H2)
  • Architecture: 64 bit
  • .NET 8.0
Other information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the GetFolderByFolderName entry point and reproduce the failing Drives[driveId].Items.GetAsync filter against SharePoint using SDK versions 5.69.0 and 5.70.0. Review the request builder behavior and issue evidence to determine whether the regression is in the SDK or the service; done means the documented folder lookup works again or the limitation and supported behavior are clearly recorded.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.