Click here to Skip to main content
12,998,483 members (85,857 online)
Click here to Skip to main content
Add your own
alternative version


4 bookmarked
Posted 23 Dec 2011

Share point 2010 - Using Web Analytic Reports programmatically

, 23 Dec 2011
Rate this:
Please Sign up or sign in to vote.
Capturing Web Analytic reports via out of the box dlls(classes)


Lately I've been asked to capture Web Analytic Reports data from Microsoft Share point 2010 programmatically. As far as I searched on web all the answers were related to acquire the data from Database, which in this article I'm not going to focus on this approach instead I'm going to use out of the box classes which are related to Web Analytic Reports. The codes are all in c# language. 


All you need is VS2010 and SHAREPOINT 2010 installed.

Using the code

To use the Web Analytic Reports data we need to add explicit reference to following dynamic link libraries (shortly dll):



There is a method called AnalyticsReportFunction  which gets all of the data for us. This is the main code which get the data for us:

Microsoft.Office.Server.WebAnalytics.Reporting.AnalyticsReportFunction a =
                            new Microsoft.Office.Server.WebAnalytics.Reporting.AnalyticsReportFunction();
foreach (AggregationLevel itm in Enum.GetValues(typeof(AggregationLevel)))
    lstRepLevel.Items.Add(new ListItem(itm.ToString(), itm.ToString()));
foreach (ReportType itm in Enum.GetValues(typeof(ReportType)))
    lstRepTypes.Items.Add(new ListItem(itm.ToString(), itm.ToString()));
object[,] res = a.GetWebAnalyticsReportData(TxtSiteUrl.Text, reportLevel,reportType,DateTime.Parse(txtFromDate.Text),

All the best.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Morteza Naeiamabadi
Software Developer (Senior)
Iran (Islamic Republic of) Iran (Islamic Republic of)
independent IT Consultant,Currently engaged with Sharepoint developing and MVC apps

You may also be interested in...

Comments and Discussions

QuestionCode Sample Pin
Member 78498486-Mar-13 10:59
memberMember 78498486-Mar-13 10:59 
GeneralMy vote of 1 Pin
Selvin24-Dec-11 3:53
memberSelvin24-Dec-11 3:53 
GeneralRe: My vote of 1 Pin
Morteza Naeiamabadi14-Jan-12 10:00
memberMorteza Naeiamabadi14-Jan-12 10:00 
GeneralRe: My vote of 1 Pin
B. Clay Shannon24-Feb-15 13:36
professionalB. Clay Shannon24-Feb-15 13:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170622.1 | Last Updated 24 Dec 2011
Article Copyright 2011 by Morteza Naeiamabadi
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid