Skip to content

Microsoft Graph API: Selecting nested properties through OData $select does not appear to work #9546

@jamesmacwhite

Description

@jamesmacwhite

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

Microsoft Graph API (SharePoint pages)

Developer environment

N/A

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

OAuth authenticated Microsoft Graph API HTTP requests using Postman.

Describe the bug / error

I'm not sure if this is a bug or limitation currently, but when returning either a single or multiple microsoft.graph.sitePage query response, I am not able to select nested properties for something like the "titleArea".

I can select the whole titleArea in a $select query, but I cannot selectively return just certain keys under this property.

Examples:

Selecting top level keys with $select

https://graph.microsoft.com/beta/sites/{siteId}/pages/microsoft.graph.sitePage?$filter=promotionKind eq 'newsPost'&$orderby=createdDateTime desc&$top=5&$select=id,title,description,webUrl,promotionKind,createdDateTime,lastModifiedDateTime

Selecting the entire titleArea also works but returns all the keys under this which adds weight to the response size.

https://graph.microsoft.com/beta/sites/{siteId}/pages/microsoft.graph.sitePage?$filter=promotionKind eq 'newsPost'&$orderby=createdDateTime desc&$top=5&$select=id,title,description,webUrl,promotionKind,createdDateTime,lastModifiedDateTime,titleArea

Trying to select a single property of the titleArea with dot notation returns no error but this is not returned in the response data

https://graph.microsoft.com/beta/sites/{siteId}/pages/microsoft.graph.sitePage?$filter=promotionKind eq 'newsPost'&$orderby=createdDateTime desc&$top=5&$select=id,title,description,webUrl,promotionKind,createdDateTime,lastModifiedDateTime,titleArea.imageWebUrl

Trying to select a single property using the forward slash notation causes a bad request error.

https://graph.microsoft.com/beta/sites/{siteId}/pages/microsoft.graph.sitePage?$filter=promotionKind eq 'newsPost'&$orderby=createdDateTime desc&$top=5&$select=id,title,description,webUrl,promotionKind,createdDateTime,lastModifiedDateTime,titleArea/imageWebUrl

I asked Co-Pilot and it seems to suggest the two notations should be possible, but neither work with differing results.

Is it possible to select specific keys within the nested property without returning the entire array? As the titleArea is not a navigation property, expand cannot be used.

Please forgive me if I am not understanding the OData syntax/documentation.

Steps to reproduce

Using the sample HTTP requests with OData $select properties outlined in the bug/error description, each result shows the current behaviour.

Expected behavior

The ability to have just a single or subset of properties be returned from the titleArea.

Metadata

Metadata

Assignees

Labels

Needs: Author FeedbackAwaiting response from the original poster of the issue. Marked as stale if no activity for 7 days.area:csom/rest/apiCategory: SharePoint Client Side Object Model SDK / REST APItype:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions