0

I am working in SharePoint Online. I want to get modern page view count. I am searching for this on google and I fount this link. In that if you scroll in the end of page, you will see that says Microsoft is building Itemanalytics api. Here is link for reference.

I tried to test this in graph explorer. Below is my URL for item analytics:

https://graph.microsoft.com/beta/sites/tenantname.sharepoint.com/sites/%7Bef9075ed-0978-441c-9c32-c0cc109e7604%7D/lists/%7Be5420cdd-4787-4a5e-8fb4-16356edc4d07%7D/items/%7Bbf29bb29-95f4-4edb-b29f-cfdf4d57f76b%7D/analytics

The issue is when I run this in graph explorer, it throws me error that

The expression \"sites('tenantname.sharepoint.com')/sites/{ef9075ed-0978-441c-9c32-c0cc109e7604}/lists('{e5420cdd-4787-4a5e-8fb4-16356edc4d07}')/items/{bf29bb29-95f4-4edb-b29f-cfdf4d57f76b}/analytics\" is not valid."

Anyone that have work on this, can you tell me what am I doing wrong?

I have checked the search API way that is explained here. But it is not working on my end. It is giving null value. Do anyone has any other option to achieve this requirement?

1

I am not sure about how to get Modern page count. But your graph API Request URL is not correct. It should be as below

For Lists

https://graph.microsoft.com/beta/sites/tenantname.sharepoint.com,b152c541-8d93-4403-9656-77c5940b67d3,20806aeb-365f-4708-8c5c-416b998276f7/lists/43838d29-e559-41eb-809d-7599f778adf0/items/2

For Library

https://graph.microsoft.com/beta/sites/tenantname.sharepoint.com,b152c541-8d93-4403-9656-77c5940b67d3,20806aeb-365f-4708-8c5c-416b998276f7/drives/b!QcVSsZONA0SWVnfFlAtn0-tqgCBfNghHjFxBa5mCdvcf3evJwzMDQJJ2GdbJlRWm/items/5

If you need help to get site id and drive id then you can refer this answer

  • Hi. I am able to get list of SharePoint list using your first API. But I am facing issue while getting site pages library. Its neither in list nor in library result. So I am not able to get its pages. – love thakker Dec 26 '18 at 8:33
  • For page you have to use Library url. Because pages it's self library – Bharat Khunti Dec 26 '18 at 8:44
  • Site Pages is library but there are no Site pages drive. So how to get drive id for Site pages – love thakker Dec 27 '18 at 9:03
  • Hi @lovethakker, you can refer github.com/microsoftgraph/microsoft-graph-docs/blob/master/… link to get site pages. Make sure you give proper permission to access – Bharat Khunti Dec 29 '18 at 15:04
  • I am checking with tenant admin user. I am not sure how more permission I can give. – love thakker Jan 2 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.