SharePoint 2010 Auditing Feature

You can use the SharePoint 2010 auditing feature and then publish the report to a library. The SharePoint Server auditing capabilities allow you to track all activities that occur within the environment. The site collection administrator has the ability to set auditing requirements within the environment that determine the types of actions that should be tracked.

To manage audit settings for a site collection, follow these steps:

  1. Navigate to the Site Settings page for the top-level site in the site collection.
  2. On the Site Settings page, in the Site Collection Administration section, click the Site Collection Audit Settings link.
  3. On the Configure Audit Settings page, identify any audit log trimming settings, and select the items to audit: a. In the Audit Log Trimming section, identify if automatic audit log trimming should be enabled, identify the number of days of audit log data to retain and specify a location to store audit reporting before trimming the audit log. This is important as you don’t want the log files to fill up the space on your drive b. In the Documents and Items section, check the boxes in front of the events to audit which you want to track e.g in your case Opening or downloading documents, viewing items in lists, or viewing item properties c. Once all of the appropriate audit options have been set, click the OK button.

To view the audit reports:

  1. Navigate to the Site Settings page for the top-level site in the site collection.
  2. On the Site Settings page, in the Site Collection Administration section, click the Audit Log Reports link.
  3. On the View Auditing Reports page, click the name of the report you want to execute.
  4. For the Run a Custom Report option, the Run a Custom Report Page is presented. On this page, follow these steps:

a. In the File Location section, select where the report should be saved once it is generated.

b. In the Location section, check if the report should be restricted to a specific list, and if so, select the web site where the list is located and select the list.

c. In the Date Range section, specify the optional Start Date and/or End Date to which the report should be restricted.

d. In the Users section, specify which users the report should be restricted to.

e. In the Events section, specify the events the report should be restricted to. In your case include the following events:

• Opening or downloading documents, viewing items in lists, or viewing item properties

• Editing items

Once all of the appropriate report settings have been entered, click the OK button.

The report is generated, and the file is saved to the library specified.

You can do the same via SP object model, Look here for example

SPWeb web = SPContext.Current.Web;

if (Request.QueryString[“list”] != null)
{
SPList list = web.Lists.TryGetList(Request.QueryString[“list”]);
if (list != null)
{
SPChangeToken listToken = list.CurrentChangeToken;
SPChangeCollection changeCollection = list.GetChanges(listToken);
foreach (SPChange change in changeCollection)
{
Response.Write(change.ChangeToken + ” – ” + change.Time + ” – ” + change.GetType() + ” – ” +
change.ChangeType);
}
}
else
{
Response.Write(“List not exist”);
}
}
else
{
Response.Write(“List Name not passed in”);
}

Advertisements

About Joseph Velliah
As a SharePoint Developer my professional interests tend to be technical and SharePoint focused. I run a blog at "SP RIDER" where you can expect to read HOW TOs and scenarios that I run into during my day to day job. I hope my posts will give back a little to the community that is helped me.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: