Graph API: Notes - List Pages Doesn't Support $count as Path Segment?

Sean DeNigris 1 Reputation point

Starting with the Notes - List Pages doc, I see that:

GET /me/onenote/pages… supports the OData Query Parameters

Following that link and scrolling down to the $count documentation, I read that:

$count can be used… as a URL segment to retrieve only the integer total of the collection. For example, users/$count.

However, when I GET$count, Graph returns a 400 error.

Is this supposed to work? If so, what might I be doing wrong? If not, how would I have been able to tell without resorting to trial and error (e.g. am I missing something in the docs)?

The only way I found to get the count was (N.B. $top=0 -> 500 error):

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,169 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Shivam Dhiman 5,861 Reputation points

    Hi @19133679

    To get the pages to count you need to use GET$count=true when you are using the above Graph API it's expecting page-id to get that page. Please refer to this documentation. To specify you are using a query parameter you need to use ?$count=true in this case.

    $top=0 is giving you an error because as per the documentation the minimum value of $top is 1 and the maximum depends on the corresponding API.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

  2. Zehui Yao_MSFT 5,796 Reputation points

    Hi @Sean DeNigris , you can request an update to the content of the documentation by posting your ideas at the following support link:
    which will be monitored by Microsoft team and make the enhancements to Microsoft Graph APIs. I will also upvote for you.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments