none
SharePoint | online | SPFx | Get file view count for a specific document library RRS feed

  • General discussion

  • Requirements:

    Some user want to know how many users checked the file stored in SharePoint library.

    Background:

    SPO audit settings don't have view option. Other similar feature "Most Popular Items" not accurate, only show 1 month data, OOB Details panel show accurate views while user need to check one by one.

    For example:

    Data in Most Popular Items


    Data in Details Panel


    Solution:

    We could create custom SPFx webpart to call SharePoint rest api to get the view count data.

    I created a demo project to get file view count for SharePoint online document library.

    If anyone interested about it, you could try it.

    I shared source code to github below, you could check ReadMe for guideline.

    https://github.com/OS-Lee/FileViewCounter

    Additional Information:

    This is a simple demo so if you want to use in production, you need optimize the source code for large library as current logic will iterate ALL files in a document library so this will case 429 issue if request many(current logic will show retrieve failed for this).

    Limitation:

    When user update the webpart document library property, the data won’t show, need refresh the page to request the data.

    Demo result:

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Friday, May 31, 2019 7:28 AM
    Moderator