API's to fetch Files/documents related metadata on SharePoint

Naveed Khan 96 Reputation points
2020-12-18T15:25:12.85+00:00

Hi Team,

There is an urgent requirement in my project to fetch below metadata of a file on Sharepoint using API.

1.Number of comments made by the author

2.Time spent by author on the document

3.Number of people who opened the document

4.Total number of open comments etc.

49515-capture.png

49516-capture1.png

Please help me to achieve the above requirements using API. Any help on this will be appreciated.

Thanks,

Pratik

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,795 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,823 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,576 questions
{count} votes

Accepted answer
  1. Naveed Khan 96 Reputation points
    2020-12-22T11:41:04.577+00:00

    I want to get Who viewed my files? Show Number of Views and Viewer Names on SharePoint Online files

    Can we achieve this with the help of API's as well?

    Please refer to the blog for more details.

    https://veronicageek.com/microsoft-365/sharepoint-online/who-viewed-my-files-show-number-of-views-and-viewer-names-on-sharepoint-online-files/2020/04/#comment-178


2 additional answers

Sort by: Most helpful
  1. Baker Kong-MSFT 3,791 Reputation points
    2020-12-21T03:09:38.12+00:00

    Hi @Naveed Khan ,

    There is analytics resource in MS Graph that could return viewer info:

    49776-image.png

    And you can get all activities including Comment Action via below endpoint:

    https://graph.microsoft.com/beta/drives/b!Nxxx1f-G/items/01xxxJX7/activities?$expand=driveItem

    49858-image.png

    Best Regards,
    Baker Kong


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    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.

    1 person found this answer helpful.
    0 comments No comments

  2. Naveed Khan 96 Reputation points
    2021-01-05T10:35:30.823+00:00

    53493-comment.pngHi Team,

    I have a requirement to fetch the below details.

    Please let me know the API with the help of that we can get the below details.(Refer the attached screenshot)

    @Baker Kong-MSFT : Please help with this.

    1.Number of comments made by the author

    2.Total number of open comments etc.