2

SPWeb.GetUsageData has been around since Windows SharePoint Services 3. In 2010 SPWeb.GetUsageData still yielded results. However, I have not found a single SharePoint installation either 2013 or 2016 in which SPWeb.GetUsageData returned anything other than null.

I know that "Web Analytics in SharePoint Server 2010" is discontinued.
However it is my understanding that SPWeb.GetUsageData relies on the "Usage and Health Data Collection service application" - which is configured and available in all the farms I checked. The needed TimerJobs ("Microsoft SharePoint Foundation Usage Data Import" and "Microsoft SharePoint Foundation Usage Data Processing") are disabled on most farms I check, but even enabling them will not make usage-data available.

On one side the SPWeb.GetUsageData help page says "gets a table that contains information about the usage of a website..." it says nothing about it being no longer supported.. But on the other side in the ...\15\template\layouts\usagedetails.aspx (the page that would show the contents of SPWeb.GetUsageData) the table called UsageReportGridView is wrapped inside a <SharePoint:UIVersionedContent UIVersion="4" runat="server"> so it will never show in SharePoint 2013/2016..

So my question is this: Are the "old" (i.e. pre-2010) usage-data informations still supported in 2013/2016?

2 Answers 2

0

As per MSDN its supported in SP2013 on-premise, there is no mention of SP2016 (so i assume its not available in SP2016).

SPWeb.GetUsageData

the code that i have used to get this done

  SPWeb oWeb = new SPSite("http://sername/sites/test").RootWeb;  

            //SPWeb oWeb = SPContext.Current.Web;   

            DataTable dt = oWeb.GetUsageData(Microsoft.SharePoint.Administration.SPUsageReportType.user, Microsoft.SharePoint.Administration.SPUsagePeriodType.day);   

            datagrid1.DataSource = dt;  

            datagrid1.DataBind(); 
8
  • Did you try this? I mean I know how it works... The method still exists in the 2016 code-base. Have you found any SP2013 in which GetUsageData yields any result besides null?
    – Nils
    Commented Aug 9, 2017 at 5:26
  • Yes it works in SP2013 Commented Aug 9, 2017 at 5:27
  • Interesting. How did you get it to work?
    – Nils
    Commented Aug 9, 2017 at 6:23
  • yesterday i tried to execute a powershell for the same on SP2013 environment but i am surprised i don't get any data now as a workaround i found this blog though briantjackett.com/2013/08/26/… Commented Aug 11, 2017 at 5:19
  • I have read that article, however it's talking about empty excel-reports and they do not depend on SPWeb.GetUsageData. Anyhow - I have tested what the article describes and the receivers in question are present in all my farms. So no - that is no explanation.
    – Nils
    Commented Aug 11, 2017 at 12:44
0

After having discussed this with Microsoft this is the not-so-offical answer:

The 2010 method SPWeb.GetUsageData() is deprecated in SharePoint 2013.

As a workaround the customer could get the data by directly going to SQL: https://technet.microsoft.com/en-us/library/jj715694(v=office.15).aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.