none
VIewsLifeTime - How to fetch User account details?

    질문

  • Hi,

    I want to display Site visitors count in my sharpoint home page. Using REST api (http://<siteurl>/_api/search/query?querytext) i got the count from "ViewsLifeTime" property. It's showing total visitors count till date. But i want to get user id's (user account) details . Is there any way to get the user account details pertaining to the page count?

    Thanks in advance.


    Thanks, Suresh




    • 편집됨 Suresr 2018년 5월 18일 금요일 오전 9:03
    2018년 5월 18일 금요일 오전 9:01

답변

  • Hi Suresh,

    Per my knowledge, there is not an API to achieve it. As a workaround, we can create a custom list(PageUrl, HitCount,UserId), then add some JavaScript into master page to achieve it.

    Get the current url using window.location.href and get current user id using  _spPageContextInfo.userId, then set the data into the custom list using jQuery Ajax and REST API.

    SharePoint 2013: CRUD Operation On List Items Using REST API Services

    https://social.technet.microsoft.com/wiki/contents/articles/33795.sharepoint-2013-crud-operation-on-list-items-using-rest-api-services.aspx

    Then get the report base on the custom list and show it in Home Page.

    Best Regards,

    Dennis


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


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    • 답변으로 표시됨 Suresr 2018년 5월 21일 월요일 오전 7:15
    2018년 5월 21일 월요일 오전 7:05
    중재자

모든 응답