question

Saintenr-1621 avatar image
0 Votes"
Saintenr-1621 asked WendyLi-MSFT edited

Get item activity stats by interval not working

the api is not working for me. We are using SPO from Germany and trying to get the activity for some documents stored in on of our libraries.

https://xxx.sharepoint.com/_api/v2.1/sites/xxx.sharepoint.com/lists/{our-library-id}/items/209/getActivitiesByInterval(startDateTime='2021-09-01',endDateTime='2021-12-31',interval='month')

It gave us the response: Item not found ->
{"error":{"code":"itemNotFound","message":"Item not found"}}

i tried the id 209 of the document. I also tried the "DocId" and "UniqueId"...

which document id is required here?

an explaination of what we are want to achieve:
We want an overview of every document stored on our Libraries, with the number of views of each document.

Thanks. Saintenr

office-sharepoint-onlinesharepoint-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered Saintenr-1621 commented

Hi @Saintenr-1621,

Per my test, I got the same result as yours. It should be the id of the document, when i use the api https://xxx.sharepoint.com/_api/v2.1/sites/xxx.sharepoint.com/lists/{our-library-id}/items/209, I could get the result for that specific document.

If I add the getActivitiesByInterval in the end, I would get the Item not found error as yours.

Currently, the Get item activity stats by interval api seems not work for using list/<list-id>/items/<item-id>. As a workaround, you could use /drives/{drive-id}/items/{item-id}. This would work 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.






· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MichaelHan-MSFT,

is the drive id my document library id?

0 Votes 0 ·

@Saintenr-1621,
It's not the document library id. You could use /drives to find the drive id of your library

0 Votes 0 ·

Ok I found out the drive id. And tried this endpoint:

https://xxx.sharepoint.com/_api/v2.1/drives/{my-drive-id}/items/206/getActivitiesByInterval(startDateTime='2021-09-01',endDateTime='2021-12-31',interval='month')


this is the response: {"error":{"code":"itemNotFound","message":"Item not found"}}

The item id should be the "ID" I can see on my library if I display the "ID" Column right?

0 Votes 0 ·
Show more comments