Forum Discussion

Saintenr's avatar
Saintenr
Copper Contributor
Mar 11, 2021
Solved

How many members have viewed a file in a SharePoint document library.

Hello Community, I would like to make a continuous evaluation of my files in SharePoint. For this purpose I am looking for the information how many people have viewed a certain file. How can I get this information through the SharePoint API?
Unfortunately, I can't find the column that contains this information. Maybe this info is also stored in another system list?

Thanks for your response
Saintenr

  • Saintenr's avatar
    Saintenr
    Jan 27, 2022
    Hi, yes i found a solution to get this each file:

    https://xxx.sharepoint.com/_api/v2.1/drives/${driveId}/items/${itemId}/getActivitiesByInterval(startDateTime='${startDate}',endDateTime='${endDate}',interval='${interval}')

    You need the ${driveId} of your SharePoint library, this is not the library id!!
    ${itemId} is the UniqueId of the document not the short ID
    ${startDate} and ${endDate} should have this format 'yyyy-mm'
    as ${interval} i used 'month' but i think 'day' any 'year should also possible.

    good luck, cheers Saintenr

2 Replies

    • Saintenr's avatar
      Saintenr
      Copper Contributor
      Hi, yes i found a solution to get this each file:

      https://xxx.sharepoint.com/_api/v2.1/drives/${driveId}/items/${itemId}/getActivitiesByInterval(startDateTime='${startDate}',endDateTime='${endDate}',interval='${interval}')

      You need the ${driveId} of your SharePoint library, this is not the library id!!
      ${itemId} is the UniqueId of the document not the short ID
      ${startDate} and ${endDate} should have this format 'yyyy-mm'
      as ${interval} i used 'month' but i think 'day' any 'year should also possible.

      good luck, cheers Saintenr

Resources