Repository navigation
Description
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
SharePoint REST API
Developer environment
None
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
No response
Describe the bug / error
What I'm doing
I'm reading view counts for the pages in a Site Pages library through Microsoft Graph, and I'm trying to get them for all items in one request instead of one request per page.
Steps to reproduce
-
Pick a Site Pages library where some pages have views.
-
Confirm a page has views with the per-item request:
GET /sites/{siteId}/lists/{listId}/items/{itemId}/analytics/allTimeThis returns the view count as expected.
-
Request the same data for all items:
GET /sites/{siteId}/lists/{listId}/items?$expand=analytics($expand=allTime)
Observed
The request returns 200, but every item has:
"analytics": { "allTime": null, "lastSevenDays": null }This includes the pages that return a view count in step 2.
Expected
Either the same values as the per-item request, or an error saying this $expand isn't supported on a collection.
Question
Is the null result the intended behaviour? If $expand=analytics isn't supported on a list's items, is that documented anywhere? I couldn't find it.
Steps to reproduce
-
Pick a SharePoint Online site with a Site Pages library where at least one page has been viewed.
-
Get the site ID:
GET https://graph.microsoft.com/v1.0/sites/{hostname}:/sites/{sitePath} -
Get the ID of the Site Pages list:
GET https://graph.microsoft.com/v1.0/sites/{siteId}/lists?$filter=displayName eq 'Site Pages' -
List the pages and note the ID of one that has views:
GET https://graph.microsoft.com/v1.0/sites/{siteId}/lists/{listId}/items -
Request the analytics for that one page:
GET https://graph.microsoft.com/v1.0/sites/{siteId}/lists/{listId}/items/{itemId}/analytics/allTimeThe response has the view count in
access.actionCount. -
Request the analytics for all items in the list:
GET https://graph.microsoft.com/v1.0/sites/{siteId}/lists/{listId}/items?$expand=analytics($expand=allTime) -
Find the page from step 5 in the response. It has
"analytics": { "allTime": null, "lastSevenDays": null }, as does every other item.
Expected behavior
Each item in the response carries the same allTime data that the per-item request returns for that item. For a page with views, that would look like:
"analytics": {
"allTime": {
"access": { "actionCount": 123, "actorCount": 45 }
}
}So for any item, analytics.allTime from
GET /sites/{siteId}/lists/{listId}/items?$expand=analytics($expand=allTime)
matches the response of
GET /sites/{siteId}/lists/{listId}/items/{itemId}/analytics/allTime
If expanding analytics on a collection of list items isn't supported, I'd expect a 400 error that says so, not a 200 response with allTime: null for pages that have views.
Activity
m365-agent-toolkit-assistant commentedon Nov 19, 2026
👋 Hi Alex Accelerator 365 (@AlexAccelerator),
Thank you for reporting this issue. Here is an AI-generated initial response:
Classification: By design — inline page view counts are a known API gap, although the
200response with null analytics has not been confirmed as intentional.allTimefor an individual item. A Microsoft contributor confirmed in a related issue that view counts currently cannot be included inline with Graph page/list-item responses.$expandbut does not explicitly explain the null result foranalytics.What to do now:
$batchto reduce round trips. Each request still counts toward throttling.200/null response as a documentation or API-behavior gap, with the paired responses and request IDs.Useful links:
Ashlesha-MSFT commentedon Nov 20, 2026
Hi Alex Accelerator 365 (@AlexAccelerator),
Thank you for providing the paired requests and detailed reproduction steps.
The list-items documentation supports $expand, and the listItem resource includes an analytics relationship. However, we have not identified documentation explicitly supporting:
or explaining the 200 OK/null response for that query. The itemAnalytics documentation lists allTime and lastSevenDays as properties; it does not establish support for the nested expansion shown here.
Therefore, the current evidence is insufficient to confirm this behavior as by design . The related Microsoft response in #10867 confirms the current inline-analytics capability gap, but does not resolve the response-behavior question raised in this issue.
For now, please continue using the documented per-item analytics endpoint. Clarification from the API owners would be needed to determine whether the collection request should reject the query or return populated analytics.