Thursday, May 25, 2017

Request Usage on SharePoint 2013 (Custom Reports)

I already explained in my previous article difference between user activity(user actions) and audit log. SharePoint logs all user actions such as site visits, list/libraries visits, page visits and so on. This information stored in SharePoint logging database. SharePoint has some out of box reports to view these data. Sometimes we need custom reports based on the request usage logged by SharePoint. These reports can be designed directly against SharePoint Logging Database either by creating new tables/views or OOTB views.

Let’s understand how we can achieve custom reports using SharePoint Logging Database.

Location:

You can do monitoring efficiently by using the logging database in SharePoint 2013. The logging database collects information from every server in the farm. The default name of the database is SharePoint_Logging. The logging database provides the option to view and customize various monitoring information in one place.

How:

The logging database uses a separate partition table for the daily data for each category. E.g. SharePoint writes the 1st day of data in dbo.TimerJobUsage_Partition0 table and for 32nd day in dbo.TimerJobUsageUsage_Partition32 table. This means, each partition table stores one particular day’s logs.

The mapping between one partition table and the exact date depends on the logging database retention period and the starting date to write logs into the logging database. You can get the mapping by observing time information inside each table. For example, if the retention period is 5 days and today’s logs are written to partition table 1, tomorrow’s logs will be written into partition table 2 and so on. After 5 days, all logs were gets deleted and new logs are written to the partition tables from first.

Access:

SharePoint Logging database has default views which can be used to access these data which is scattered between these partition tables. One of the default view is RequestUsage. This view provide the combined user activity data from all partition tables.

Actual Implementation: 

     SharePoint Logging database has retention period of 3 days by default. This can be changed using power-shell command. changing these retention period may add more load on database since SharePoint Logs millions of rows per days. I am sure changing this to more than 30 days may add lot of rows and increase the size of logging database too.

       I would recommend the intermediate table which can be used to store this data for more than specified limit days. Follow below steps. (Logging database is the only SharePoint 2013 database for which you can customize reports by directly changing the database).


  1. Create new table in SharePoint Logging Database. 
  2. Create new custom view which can filter these data by previous day using the above view “RequestUsage”. Be sure to filter the records since “RequestUsage” will give you millions of rows since SharePoint logs each and every minute activity of user. E.g. if you visit one page in SharePoint then it logs each and every entity used on that page as separate rows.
  3. Create the SSIS package or executable which will Import the custom view output into the new custom table.
  4. Schedule the SSIS Package or executable daily.
  5. Create reports based on the new custom table.

Wednesday, May 03, 2017

User Activity Report Vs Audit Log in SharePoint 2013

It’s very important that your intended users should be benefiting value out of SharePoint for not only storing but their usage too. Management decisions are based on metrics-driven and hence SharePoint does various analysis appropriate for SharePoint Administrator to measure, monitor and produce activity and audit reports.

User activity is defined as some action taken by User on web, site, or documents (SharePoint Items). SharePoint comes with lot of out-of-box Usage and Audit reports which worth considering. Lets first understand difference between Usage and Audit.

Usage Reports:


When term Usage comes it refers to the Usage of particular web application, site, or Document. Analytics Processing Component in SharePoint Server 2013 analyzes both the content itself, and also the way that users interact with it. The results from the analysis are added to the items in the search index so that search relevance improves automatically over time. Also, the results are used in reports that help search administrators see which manual steps they can take to improve the search system.

Report
Displays
Usage Summary
Average Requests per day, Top Pages, Top Users, Top Referring Hosts, Top Referring Pages, Top Destination Sites, Top Queries, Search Results Top Destination Pages
Requests
Requests per day, Average Requests by month
Users
Unique Users, User Activity (past 30 days)
Referrers
Top Referring Hosts, Top Referring Pages
Destination
Top Destination Sites
Home Page
Home Page Requests per Day, Top Referring Pages, Top Destination Pages
Search Queries
(site collection only)
Top Queries (Previous 30 days, Previous 12 Months), Queries per Scope
Search Results
(site collection only)
Top Destination Pages, Queries with Low Click Through, Queries with Zero Results, Queries with Zero Best Bets

This data is not stored forever in the SharePoint Database. Usage analytics is a set of analyses that receive information about user actions, or usage events, such as clicks or viewed items, on the SharePoint site. The usage events are stored temporarily on the web front end and are pushed to the Search Service Application every 15 minutes. Usage events are kept on disk for up to 14 days before they are deleted. This number of days you can control in Central Administration or using Powershell commands. Usage analytics combines this information with information about crawled content from the Search analyses, and processes the information. Information about recommendations and usage events is added to the search index. Statistics on the different usage events is added to the search index and sent to the Analytics reporting database.

Based on these statics the different reports are generated by SharePoint Out-of-box.
To access these reports, Visit your Web Application > Site Settings > Popularity and Search Reports. Of course you can customize these reports using Powershell.

Audit Log Reports:


SharePoint Audit logs allows you to capture whole range of audits on your SharePoint Farm based on your needs. SharePoint allows you to control which web application, Site collection, or even libraries to be monitored.

It might seem like overkill, but being able to track how individual end users make use of your SharePoint environment is very helpful. Audit logs is to set them to delete logs within a reasonable amount of time. This can be managed from Central Administration and it is default to 30 days. Fortunately, you can set SharePoint to delete these outdated logs when you need to. Audit logs can quickly duplicate, and expand so fast they fill up your SQL Server so beware to enable them on your Site. The audit logs stored in the Content Database only hence you need to be extra cautious when enabling the Audit Log.

Note: Each time you set up a new site, you’ll also need to configure the audit log for it – this won’t be applied automatically. SharePoint audit logs also let you set up audit flags that allow you to track specific changes.
·       Check in/check out
·       View
·       Delete/undo
·       Update
·       Schema and profile changes
·       Security change
·       Copy/move
·       Search
·       Workflow child delete
·       Other flags for a whole range of other events

To access these reports, Visit your Web Application > Site Settings > Audit Log Reports. 
To set Audit Log settings, Visit your Web Application > Site Settings > Site Collection Audit Log Settings.

In my opinion, when you just need to monitor the usage of the Site Usage reports are the best. Whereas if you want to do the details analysis of how your site being used by users in terms of uploading, viewing, deleting documents I would recommend to activate Audit log for your site.

I came across with one requirement where my client want to know all users who has visited their intranet SharePoint web application, site collections and web sites. They want to track this for at-least 2-3 years before they discard this analytics. The catch is SharePoint stores statics but do not store the actual user wise data for more than 30 days. My next article will explain on how to achieve this.


Wednesday, March 08, 2017

List Views disappear from view selector menu whenever views created programatically

I was developing an automated code which will create views dynamically on SharePoint List. The code was working perfectly for other types of views except for Data Sheet view. The fact that other people are experiencing this makes me suspect of an issue in the API but perhaps there is something we can do to overcome this.

I was surprised when i was adding the view manually through UI was working fine.

This weird issue happens when you are trying to create views programatically. This issue comes in both SSOM or CSOM and it also happens in various types of views, such as Datasheet and Calendar and may be with others. 

The workaround is to trigger an update on the DisableViewSelectorMenu webpart property, which can be achieved by manually editing the view webpart through the user interface, or programatically updating the property and the webpart, as shown below:

From SharePoint UI:



Programtically:













































private static void FixWebPartViewSelector(SPWeb web, SPList list, SPView view) { var pageUrl = web.Url + "/" + view.Url; SPLimitedWebPartManager webpartmanager = web.GetLimitedWebPartManager(pageUrl, System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared); XsltListViewWebPart wp = webpartmanager.WebParts[0] as XsltListViewWebPart; wp.DisableViewSelectorMenu = true; webpartmanager.SaveChanges(wp); wp.DisableViewSelectorMenu = false; webpartmanager.SaveChanges(wp); }



Wednesday, February 01, 2017

Drag and Drop file functionality in MVC 5 & HTML using dropzonejs

I was working on one of the requirement where i need to drag and drop files in MVC based application. I tried to googled and came across number of implementation. I came across following implementation which i like most and easy to implement.

I will try to explain the basic here how to use dropzonejs quickly.

  • Prequisites: We required following files for working example. both the files can be found and downloaded from here. Be sure to read warning message by Author.  
    • dropzone.js
    • dropzone.css
  • Steps:
    • Add these files in your MVC project.
      • .js => "Scripts/custom" folder
      • .css => "Content" folder
    • Modify the BundleConfig.cs files to add css files and javascript file
bundles.Add(new Scripts("~/bundles/dropzonescripts").Include(
                     "~/Scripts/custom/dropzone.js"));
bundles.Add(new Styles("~/Content/dropzonescss").Include(
                     "~/Content/Site.css",
                     "~/Content/dropzone.css"));
    • Render Css style using above bundle in _Layout.cshtml page "Head" Tag and render javascript  using above bundle in _Layout.cshtml page at bottom.

    • Add following div tag in page (in my case it was "FileTranslation\Index.cshtml" where you want to implement the Drag and Drop files facility.
      Note: FileTranslation is my controller name and SaveUploadedFile is my action. be sure to change if you have another name for controller and action.
<div class="jumbotron">
<form action="~/FileTranslation/SaveUploadedFile" class="dropzone" enctype="multipart/form-data" id="dropzoneForm" method="post">
<div class="fallback">
<input multiple="" name="file" type="file" />
            <input type="submit" value="Upload" />
        </div>
</form>
</div>
    • Add following script block in page where you have copied above code. Please make sure autoProcessQueue = true. This allows you to start transferring files automatically as soon as they dropped. if you want to manually upload filed make this parameter as false.
@section scripts {

    <script type="text/javascript">
        //File Upload response from the server
        Dropzone.options.dropzoneForm = {
            maxFiles: 2,
            autoProcessQueue: true,
            init: function () {
                this.on("complete", function (data) {
                    var res = eval('(' + data.xhr.responseText + ')');
                });
            }
        };
    </script>
}
    • Add following Action in "FileTranslation" Controller
      • Index()
      • SaveUploadedFile()
        private const string TempPath = @"C:\00-SandeepP";
        public ActionResult Index()
        {
            return View();
        } //Index()
        public ActionResult SaveUploadedFile()
        {
            bool isSavedSuccessfully = true;
            string fName = "";
            try
            {
                foreach (string fileName in Request.Files)
                {
                    HttpPostedFileBase file = Request.Files[fileName];
                    //Save file content goes here
                    fName = file.FileName;
                    if (file != null && file.ContentLength > 0)
                    {
                       string pathString = System.IO.Path.Combine(TempPath);
                        

                        var fileName1 = Path.GetFileName(file.FileName);

                        bool isExists = System.IO.Directory.Exists(pathString);

                        if (!isExists)
                            System.IO.Directory.CreateDirectory(pathString);

                        var path = string.Format("{0}\\{1}", pathString, file.FileName);
                        file.SaveAs(path);
                    }
                }
            }
            catch (Exception ex)
            {
                isSavedSuccessfully = false;
            }

            if (isSavedSuccessfully)
            {
                return Json(new { Message = fName });
            }
            else
            {
                return Json(new { Message = "Error in saving file" });
            }
        } //SaveUploadedFile
    • Press F5 and you are ready to go to check your drag and drop files working


Monday, January 16, 2017

MVC 4 Rajor - [A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.HostSection

Hello guys,

I was doing a MVC project for one of my client and received following error when i updated my MVC version from Library Package Manager > Manage NuGet Packages for Solutions...

[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A originates from 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'. Type B originates from 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\vs\1779caca\ec838677\assembly\dl3\3dd21433\efc909b6_6889d201\System.Web.WebPages.Razor.dll'.

 This weird error was making me crazy. After lot of search on internet i found some article specifying the error caused by version. You can clearly make out from above error its true.

I found out that of Web.config resides inside the View folder of my project was referring to version 2.0.0.0. I have just changed the all versions from 2.0.0.0 to 3.0.0.0 in following section






Hola!!!!!!!!!!!!!!!!

Error gone...





Wednesday, January 11, 2017

Azure Series - Hosting Angular 2 site in Azure environment

I just started in angular 2 TS script development and I wanted to showcase my demo to my senior management. The demo site was on my laptop. It was not possible for me to take my laptop every time to a different person to show my demo site.
I was searching on the net for how to host my angular demo site on the web/Internet so that I can easily showcase my skills. I hosted my first angular app on the Azure environment. Azure App Service has first-class ASP.Net , Node.js, Java, PHP, and Python support. It's very easy just follow the following steps:

Prerequisites:

  • Make sure you have synchronized your code in the GitHub repository.

Steps:

  1. Get your Azure subscription (If you don't want to buy it's free for 30 days).
    https://azure.microsoft.com/en-us/free/ 

  2. Create a Web App in the APP Service module once you have a subscription.



  1. Once the application is created, select "Deployment Options".

  1. Select the source to deploy files.


You can choose different sources as per your choice:

  1. In my case, I selected GitHub.
  2. Provide credentials for GitHub when prompted.
  3. Select the Project from GitHub
  4. Select Branch.

You are done. Let the Synchronization happen and you are ready to browse your Angular Application.

Note: I guess and I am not sure since when I hosted my Angular App it was running without any issues. I suspect the node_modules directory is already added by Microsoft when you create the web app since they support Node.js.

Tuesday, December 27, 2016

Angular 2 - use gulp to automate tasks

Recently i was working on Angular TS project. I heard about gulp and its features. gulp is a toolkit for automating painful or time-consuming tasks in your development workflow, so you can stop messing around and build something.

Basically i found it is useful to do some tasks such as Build directory structure for your production deployment. To use gulp you need to follow below steps

If you've previously installed gulp globally, run npm rm --global gulp before following these instructions
  1. Install gulp-cli globally
    npm install -globally gulp-cli
  2. Once you install gulp-cli. You can add for development by running following command. this command install the gulp and adds entry in package.json.
  3. npm install --save-dev gulp
  4. Simillarly you can install gulp-util and so-on. e.g.
    npm install --save-dev gulp-util
  5. Create gulpfile.js in your project root ditrectory.
    e.g. code

    /* File: gulpfile.js */

    // grab our gulp packages
    var gulp  = require('gulp'),
        gutil = require('gulp-util');

    // create a default task and just log a message
    gulp.task('default', function() {
      return gutil.log('Gulp is running!')
    });
  6. open command prompt of your project root folder and type "gulp". you will get following result. Basically the "gulp" command look into your current folder for gulpfile.js file and run it.

    C:\>gulp
    [14:00:06] Using gulpfile C:\..\..\gulpfile.js
    [14:00:06] Starting 'default'...
    [14:00:06] Gulp is running!
    [14:00:06] Finished 'default' after 11 ms
Some times you may get the following error when you try to run the "gulp" command even after proper installation.
'gulp' is not recognized as an internal or external command

Solution: Type following command in the Command Prompt
PATH=%PATH%;C:\Users\username\AppData\Roaming\npm

Monday, November 28, 2016

Angular 2 - Gulp - change extension of file

Gulp-ext-replace allow us to change extension of file when it is copied to the destination.

Lets take a example below:

we have a file called consultants.json present under App/Data folder. we want to copy this file as soon as it changes to the destination folder Build/App/data. While copied in destination folder it should change the extension to consultants.txt

To do this we can take help of gulp-ext-rename package to install run following command:
Note: Prior to that make sure you have gulp-cli installed globally.

npm install --save-dev gulp-ext-replace

once we have installed this we can create  a watch in our gulpfile.js as below:

// grab our gulp packages
var gulp  = require('gulp'),
    gutil = require('gulp-util'),

    gextreplace = require('gulp-ext-replace');

// watch .json file changes in app/data/ directory
// if any .json file changes then save as .txt in Build/app/data 
gulp.watch('app/data/*.json', function(obj) {
    gutil.log('Gulp - Copying .json file [ ' + obj.path.basename + ' ] to build folder - started');
    
    gulp.src(obj.path)
      .pipe(gextreplace('.txt'))                // changing extension of file before copy
      .pipe(gulp.dest('build/app/data')) // copy .txt file in respective folder of "build" folder 
    
    gutil.log('Gulp - Copying .json file [ ' + obj.path.basename + ' ] to build folder - completed');
});

First, grab our gulp packages by gextreplace = require('gulp-ext-replace') command.

Second, create watch on all .json file by gulp.watch('app/data/*.json'...  command.

Third, specify the source of file by gulp.src command.
use pipe to add another command to replace the extension from '.json' to '.txt'.
use pipe command to add another command gulp.dest which will have the destination folder details where we need to copy the file.

Friday, June 27, 2014

SharePoint - Enable Filtering for Multiple SPGridView Control on same page

Hello Everyone, I have seen people implementing the SPGridView in their project/Webpart. When we try to use this webpart multiple times on same page the filtering does not work on multiple Grids correctly.
Let’s see how we can fix this.
The most essential part is referring aspgridview.js file in your control.



This js file helps us to run the Filter functionality.

The file has all the java script function which helps us to display the filtering actions. The ASPGrid view has one bug, if you try to add two SPGridView control on same page. The control starts misbehaving on filtering front. This happens since client id is not passed correctly to java script.
To resolve this I searched on net and found lot of people talking about the root cause of the problem and solution. But no one has solution which is generalized and will work for your grid filter column.
All the examples have shown how to fix it for individual column only.

-----------------------------------------------------------------------------

Here is code snippet which you need to add in your Web Part and call this method in Pre_Render method of your web part after binding grid view.

ColIndex refer to the index of the Column header which helps to apply filter menu.

protected void overrideFilterMenus(SPGridView SPGridViewObject)
        {
            int colIndex = 0;
            foreach (string strFilterColumn in SPGridViewObject.FilterDataFields.Split(','))
            {
                if (!string.IsNullOrEmpty(strFilterColumn))
                {
                    if (SPGridViewObject.HeaderRow.Controls[colIndex].Controls[0].GetType().Equals(typeof(Microsoft.SharePoint.WebControls.Menu)))
                    {
                        ((Microsoft.SharePoint.WebControls.Menu)SPGridViewObject.HeaderRow.Controls[colIndex].Controls[0]).ClientOnClickPreMenuOpen =
                          "SPGridView_FilterPreMenuOpen('" +
                          SPGridViewObject.ClientID + "','" + SPGridViewObject.ClientID +
                          "_SPGridViewFilterMenuTemplate', '%MENUCLIENTID%', '" + strFilterColumn + "', event);" +
                          " MMU_Open(byid('" + SPGridViewObject.ClientID + "_SPGridViewFilterMenuTemplate')," +
                          " MMU_GetMenuFromClientId('%MENUCLIENTID%'),event,true,null,0); return;";


                    }
                }
                colIndex++;
            }
        }


Tuesday, May 13, 2014

SharePoint 2010 Style Paging in SPGridview using SPGridViewPager

Hi,

We have seen lot of examples which explains how to implement paging for your SPGridView.

The implementation is pretty much simple. you need to set PagerTemplate  property to Null and rest Microsoft will do for you. The System automatically gives you the paging style of 1,2,3......... you need to write pagination events. But most of the time clients demands the same look and feel as of SharePoint where you need to show pagination in SharePoint OOTB Style.


Microsoft has provided SPGridViewPager control which allows us to display the paging as per the SharePoint OOTB Style. We just need to provide the GridView ID. This control added on the form where your SPGridView is added separately.



Note: If you are using SPGridViewPager control, then do not set PagerTemplate Property to Null which coding.

Rest if you like to change the look and feel of Pagination, you can easily extend your new class from SPGRidViewPager Class and use it.

Cool!!!!









Monday, July 15, 2013

SharePoint 2010 - Adding Folders and Items inside Folder using PowerShell

I came across situation where I need to add the Folders and items within that folders using PowerShell to check threshold problem. I thought adding the items more than the threshold value, PowerShell will be ideal to run on SharePoint System.

Here is the PowerShell Script which creates 30 folders inside the Custom List and 200 items in each Folder.
Only requirement to run this Script is custom list named as “ProjectPhones”.

Note:
  • You can have your own list. Just change the name in script (Highlighted)
  • While running script add your Site Url as parameter where the list is situated
PowerShell Script:

Add-PsSnapin Microsoft.SharePoint.PowerShell


# read site url
$siteUrl=$args[0]

write-host $siteUrl
$site = new-object Microsoft.SharePoint.SPSite($siteUrl)
write-host $site
$web = $site.OpenWeb()

write-host $web
$list = $web.Lists["ProjectPhones"]
write-host $list

$F=1
$i=1


for($F=1; $F -le 30; $F++)
{
                write-host "Creating folder - Folder " + $F
                $folder = $list.AddItem("", [Microsoft.SharePoint.SPFileSystemObjectType]::Folder)
                $folder["Title"] = "Folder" + $F
                $folder.Update();


                for($i=1; $i -le 200; $i++)
                {
                                write-host "Adding " + $i  + " Item in Folder[" + $F + "]"

                                $ListItem = $list.AddItem($folder.Folder.ServerRelativeUrl,[Microsoft.SharePoint.SPFileSystemObjectType]::File, $null)

                                $ListItem["Title"] = "PhoneNumber Folder-" + $F + "-" + $i
                               

                                $ListItem.Update()
                }
}
$web.Dispose()
$site.Dispose()


Remove-PsSnapin Microsoft.SharePoint.PowerShell

Hope this helps anyone in need.

Tuesday, May 14, 2013

SharePoint 2010 - Web part page with Quick Launch

when you create webpart page, it is always created without quick launch. This is normal behavior of SharePoint. i have seen most of the developer stuck over here to get the quick launch.

Here is the solution to get quick launch on our new pages created using web part pages.

Before we see solution lets understand how and where quick launch is displayed.

SharePoint has master page  and each page is getting inherited from the master page. Quick launch is placed on master page under contentplaceholder id "PlaceHolderLeftNavBar" and Div Tag named as "s4-leftpanel"




Where as in webpart page this contentPlaceHolder is empty as well as the div "s4-leftpanel" which display the quick launch is hidden using script (See Below)




Solution:
  1. Remove hte ContentPlaceHolder with name "PlaceHolderLeftNavBar" from webpart Page
  2. Change the Display: None to Display: Block in CSS Script.

Thursday, February 14, 2013

Access User information from User Profile using SharePoint Object Model

Access User Profile from Console Application to retrieve user information

Most of the time we require user information for our application. the best way to get these information from User Profile. Here is the code which describes how we can connect to User Profile service and get the user information.

I assumed that User Profile service application is already setup by Farm Admin.


I also assumed that you have Web App already created e.g. http://win-urbt9f048vo:9999.

Following is the Code which will access user profile service application to get the information of specific user.

Required Namespace:
  • System.Web
  • Microsoft.Office.Server
  • Microsoft.Office.Server.UserProfile
  • Microsoft.SharePoint

Code 1st Part: Here we are trying to access the Site and pass the User ID to FillUserProfileDetails Function.


Code 2nd Part: Here we are trying to get the service context of the Site. After getting service context creating UserProfileManager Object which will fetch the user data using GetUserProfile method.

GetUserProfile Method require the login id of the user.

Once it return the object UserProfile filled with all information, each property can be individually.
All default properties details can be found here. properties are mapped with AD. yo can also retrieve any custom property created in User Profile.





Tuesday, September 18, 2012

Configure audit settings for a individual List/Library


So far we have seen in my previous articles how to “Configure Audit Setting for Site Collection” and “Viewing Audit log report”. 

SharePoint audit policy can be enabled at site collection level setting but this may lead in many problems potentially generate a large number of audit events, particularly when the setting for viewing items or item properties is enabled and leading to either not being able to get the events you need for important lists or libraries or else enabling too much auditing and getting way to many events.

Thankfully in SharePoint 2010, Microsoft has provided the auditing on specific document libraries or lists.

At the list and library level we have a variety of activities that can audit including:

  • Viewing
  • Editing
  • Deletion
  • Check in /Check out

List/library level audit policy is extremely important when it comes to auditing who is viewing confidential information. If you enable View auditing at the site collection level you end up generating events for every page click by every user throughout the entire site collection which will create a load on resources.

Configure audit settings for a individual List/Library

  1. On the site collection home page, select List or Library from Quick Launch or Site actions > View All Site Content.
  2. On selection of List/Library click on List/Library setting icon on ribbon.
  3. Select “Information management policy settings” link under Permissions and Management.
    image1
  4. if your list has content type then it will display folder and content type (s) to select on which we can apply the audit policy.

    image3

    image2
  5. For instance a normal document library will have 2 content types: Document and Folder. Click on a content type and configure auditing. In the example below I’ve enabled auditing of any type of view and download access since this is a library contains confidential information.
    image4
  6. once you select Ok, SharePoint will begin auditing those actions on that particular list or library.
  7. you can use “Audit Log Report” to see individual List/Library audit report.

You can also see,