none
How to do coding to obtain statistics in SharePoint 2013? RRS feed

  • Question

  • I have setup 100+ community sites and one community portal. I need to get the following statistics every month and overall from each one of the community site

    • Total number of Documents opened from a each community site
    • Total number of Posts or replies physically opened from each community discussion list. Not just viewing the discussion list
    • Total number of Community site Members joined thru membership.
    • Total number of unique visitors to each community site excluding the community Members.
    • Total reputation points in each Community site

    I am not allowed to deploy Visual Studio solutions but can use power shell or client side scripting. Please advise where to do the code against what object model. I tried looking in to Audit Data, Popularity Trend and most Popular Items but does not seems to be all the required data are available. Please advise where to start this from as I am not a geek yet? Thanks in advance.

    Tuesday, December 20, 2016 5:42 AM

Answers

  • Hi,

    1. To get the total number of document opened, please check the client object model below:

    public class Microsoft.SharePoint.Client.Audit
    public enum Microsoft.SharePoint.Client.AuditMaskType
    public class Microsoft.SharePoint.Client.AuditPropertyNames 

    2. Get the total number of Posts or replies physically opened from each community discussion list, we can use REST API to achieve it.

    https://msdn.microsoft.com/en-us/library/office/dn292552.aspx

    3. Get total members, we can also use REST API.

    /_api/web/lists/getbytitle('Community%20Members')/items

    4. To get the total numbers of the visitors, we can get the visitors group using REST API.

    Users, groups, and roles REST API reference

    https://msdn.microsoft.com/en-us/library/office/dn531432.aspx

    5. Get reputation score, we can also use REST API.

    _api/web/lists/getbytitle('Community%20Members')/items?$select=ReputationScore

    Best Regards,

    Dennis


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

    • Proposed as answer by Patrick_LiangModerator Wednesday, December 28, 2016 6:53 AM
    • Marked as answer by MC ROY Sunday, January 1, 2017 11:54 AM
    Wednesday, December 21, 2016 2:51 AM
    Moderator

All replies

  • Hi,

    1. To get the total number of document opened, please check the client object model below:

    public class Microsoft.SharePoint.Client.Audit
    public enum Microsoft.SharePoint.Client.AuditMaskType
    public class Microsoft.SharePoint.Client.AuditPropertyNames 

    2. Get the total number of Posts or replies physically opened from each community discussion list, we can use REST API to achieve it.

    https://msdn.microsoft.com/en-us/library/office/dn292552.aspx

    3. Get total members, we can also use REST API.

    /_api/web/lists/getbytitle('Community%20Members')/items

    4. To get the total numbers of the visitors, we can get the visitors group using REST API.

    Users, groups, and roles REST API reference

    https://msdn.microsoft.com/en-us/library/office/dn531432.aspx

    5. Get reputation score, we can also use REST API.

    _api/web/lists/getbytitle('Community%20Members')/items?$select=ReputationScore

    Best Regards,

    Dennis


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

    • Proposed as answer by Patrick_LiangModerator Wednesday, December 28, 2016 6:53 AM
    • Marked as answer by MC ROY Sunday, January 1, 2017 11:54 AM
    Wednesday, December 21, 2016 2:51 AM
    Moderator
  • HI, Thanks for your reply. I will explore the options you have recommended for the requirements and update here. But in regards to bullet number 4 what I am looking for is different.

    I need to know how many unique users visited the Community site. Not the number of users exist in the site Visitor group.

    Wednesday, December 21, 2016 7:16 AM
  • Hi,

    For the number 4, please check the similar thread below:

    http://sharepoint.stackexchange.com/questions/57847/what-does-total-number-of-daily-unique-visitors-really-mean

    Best Regards,

    Dennis


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

    Wednesday, December 21, 2016 8:33 AM
    Moderator
  • Hi, For Bullet number 4: Web analytics is for Sp2010 and no longer available in SP2013 I believe. My question is specific to SP2013.
    Thursday, December 22, 2016 4:21 AM
  • Hi,

    SharePoint 2013 provide new capability and analytics in the form of Popularity Trends. Popularity Trends can be accessed by Site Admins who are interested in looking at data for a specific Site or Site Collection.

    https://sp2013wade.codeplex.com/

    Best Regards,

    Dennis


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

    Thursday, December 22, 2016 6:22 AM
    Moderator
  • Hi,

    Any update?

    If the replies help you, please mark the reply as answer, it will make others who stuck with the similar issue easier to search for valid solutions in this forum.

    Best Regards


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

    Wednesday, December 28, 2016 6:53 AM
    Moderator
    1. I tried it using server object model and it works like a charm. I am wondering if I can do the same using REST API CALL? Is there REST api available for this purpose?
    2. Used https://msdn.microsoft.com/en-us/library/office/dn292552.aspx and works.
    3. Used /_api/web/lists/getbytitle('Community%20Members')/items and works
    4. I am unable to find teh unique visitors yet.
    5. Used _api/web/lists/getbytitle('Community%20Members')/items?$select=ReputationScore and it mets my requirement

    • Edited by MC ROY Sunday, January 1, 2017 11:53 AM typo
    Wednesday, December 28, 2016 8:21 AM