Skip to content

Get all files from a specific folder(drive) in Sharepoint site. #2777

@MathavanN

Description

@MathavanN

Describe the bug

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

Microsoft.Graph V5.63.0

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();
}

I am using QueryParameters filter to get the specific folder. I have tested this code and I am sure that the filter works. Application has been running in Live for a while.

Last 2 days (from Dec 14, 2024), I see that the filter is not working. driveItemCollectionResponse contains all files and folders from Sharepoint site.

Result from 14th Dec, 2024
Screenshot 2024-12-16 092219 PNG

Expected behavior

Expected to filter by folder name and webUrl.
Screenshot 2024-12-16 092220

How to reproduce

Get items from a sharepoint drive and apply filter.

SDK Version

5.63.0

Latest version known to work for scenario above?

5.63.0

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions