I need to retrieve list items from a document library. The list items are retrieved by looking at a specific property named "X-transaction" (I have no control over the name of the property). I have a CSOM client that retrieves these items just fine using a CAML query, but we're migrating to Graph and I need to port the code over.
I have a properly configured GraphServiceClient
that I have verified can be used to retrieve the title of the doc library. I'm trying to understand how to formulate the query.
Should I be using Drives[drive.Id]
to obtain the list items, or Lists[list.Id]
?
When I try using drives:
var docLib = await ctx
.Sites[site.Id]
.Drives
.Request()
.GetAsync();
var drive = docLib.FirstOrDefault(d => d.Name == "DocLibraryName");
var filterQuery = $"field/X_x002d_transaction eq '{transactionId}'";
var items = await ctx.Drives[drive.Id]
.Items
.Request()
.Filter(filterQuery)
.GetAsync();
I get a syntax error exception:
Status Code: BadRequest
Microsoft.Graph.ServiceException: Code: invalidRequest
Message: One of the provided arguments is not acceptable.
Inner error:
Code: badArgument
I'm clearly misunderstanding the syntax here. How should this filter be formatted?
If I instead try to read from a list, I get a complaint that filters are not supported on lists. It appears that avenue is closed off: true or false?