You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using expand with nested select for reading items in SharePoint site's list the SDK generates wrong query.
Let's say I have a request
GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?expand=fields(select=createdDateTime)
It works fines for example from Graph Explorer. Based on the documentation here and here the query is correct and developers are familiar with this syntax and they are used to use this syntax.
The code for the query above is
var result = await graphClient.Sites["{site-id}"].Lists["{list-id}"].Items.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Expand = new string []{ "fields(select=createdDateTime)" };
});
which looks fine but when executed it fails with the error
Parsing OData Select and Expand failed: Term '(select=createdDateTime)' is not valid in a $select or $expand expression.
The root cause is that SDK generates wrong URL with $expand instead of expand
Workaround
The workaround is to use $select instead of select in Expand.
var result = await graphClient.Sites["{site-id}"].Lists["{list-id}"].Items.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Expand = new string []{ "fields($select=createdDateTime)" };
});
Additional context
I'm not sure if the issue requires a fix in SDK or in the documentation but if https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?expand=fields(select=name) is correct syntax then SDK should be able to handle it.
It would be nice if SDK team can discuss the issue with Graph API team.
What I remember the $ prefix is optional only for beta version but v1.0/sites/{site-id}/lists/{list-id}/items endpoint supports both.
The text was updated successfully, but these errors were encountered:
Describe the bug
When using
expand
with nestedselect
for reading items in SharePoint site's list the SDK generates wrong query.Let's say I have a request
It works fines for example from Graph Explorer. Based on the documentation here and here the query is correct and developers are familiar with this syntax and they are used to use this syntax.
The code for the query above is
which looks fine but when executed it fails with the error
The root cause is that SDK generates wrong URL with
$expand
instead ofexpand
Workaround
The workaround is to use
$select
instead ofselect
inExpand
.Additional context
I'm not sure if the issue requires a fix in SDK or in the documentation but if
https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?expand=fields(select=name)
is correct syntax then SDK should be able to handle it.It would be nice if SDK team can discuss the issue with Graph API team.
What I remember the
$
prefix is optional only for beta version butv1.0/sites/{site-id}/lists/{list-id}/items
endpoint supports both.The text was updated successfully, but these errors were encountered: