Saturday, 6 December 2014

SharePoint 2010: Content Type Hubs – Publish and Subscribe to Content Types

Accordion-Style Left Navigation Using jQuery and CSS in SharePoint 2010

Introduction
All the Quick Link menus provided by SharePoint2010 out of the box have a fixed format and altering its CSS alters its branding. Implementing collapsible headings in the quick launch for SharePoint 2010 (jQuery UI accordion effect) would solve this issue. All the solutions that I've seen are for sites and sub sites. In the site navigation settings, I have entered a heading with links to site pages under it.

My current navigation works fine. For example if a category is open it will remain open until the category is clicked on. I implement an accordion on SharePoint current navigation.

However we can do collapsing and expanding functionality using:

  • jQuery
  • CSS 
jQuery
If you want the accordion-style menu for all pages, you should work it into the v4.master.

You need to add the following code into the v4.master.

To edit, open the v4.master in SharePoint Designer 2010, share this piece of code to obtain an accordion style quick launch in SharePoint 2010.
  1. <script type="text/javascript" src="http://ajax.Microsoft.com/ajax/jQuery/jquery-1.7.1.min.js">  
  2.    
  3. <script type="text/javascript">   
  4. $(function($) {  
  5.  //Hide all  
  6.  $('.s4-ql li ul').hide();  
  7.  //Set the Images up  
  8.  var Collapse = "/_layouts/images/collapse.gif";  
  9.  var Expand = "/_layouts/images/expand.gif";  
  10.   
  11.  //Find each top level UI and add reletive buttons & children numbers  
  12.   
  13.  $('.s4-ql ul li').find('ul').each(function(index) {  
  14.  var $this = $(this);  
  15.  $this.parent().find('a:first .menu-item-text').parent().parent().parent().prepend(['<a class=\'min\' style=\'float:right; margin-left:5px;margin-top:6px;margin-right:5px;\'><img src=\'/_layouts/images/expand.gif\'/></a>'].join(''));  
  16.  });  
  17.  //Setup Click Hanlder  
  18.  $('.min').click(function() {  
  19.  //Get Reference to img  
  20.  var img = $(this).children();  
  21.  //Traverse the DOM to find the child UL node  
  22.  var subList = $(this).siblings('ul');  
  23.  //Check the visibility of the item and set the image  
  24.  var Visibility = subList.is(":visible")? img.attr('src',Expand) : img.attr('src',Collapse);;  
  25.  //Toggle the UL  
  26.  subList.slideToggle();  
  27.  });  
  28.  });  
  29. </script>  
sharepoint home page

CSS
It is possible to do it with pure CSS. When it comes to SharePoint there is only one caveat; you can create a CSS with only an accordion menu as long as the accordion effect fires on hover and not when the navigation header is clicked.

Add the following CSS into the v4.master:

To edit, open the v4.master in SharePoint Designer 2010.
  1. <style>  
  2.         .s4-ql li.static 
  3.         {  
  4.             height2em;  
  5.             overflowhidden;  
  6.         }  
  7.   
  8.         .s4-ql li.static:hover 
  9.         {  
  10.             heightauto;  
  11.         }  
  12.   
  13.         .s4-ql li > span.menu-item 
  14.         {  
  15.             cursorpointer;  
  16.         }  
  17.         /* Format the headers */  
  18.         .s4-ql li > span.menu-item 
  19.         {  
  20.             cursorpointer;  
  21.             background#0171C6;  
  22.             colorwhite;  
  23.             bordersolid #fff;  
  24.             border-width1px 0;  
  25.         }  
  26.         /* Format the accordion list items */  
  27.         .s4-ql a.menu-item 
  28.         {  
  29.             color#000;  
  30.             background#C9D4FF;  
  31.             border1px solid #97C8F7;  
  32.             border-bottomnone;  
  33.         }  
  34.         /* Format the header hover, list item hover and currently selected item */  
  35.         .s4-ql li > span.menu-item:hover, /*Header */  
  36.         .s4-ql a.selected, /* Selected */  
  37.         .s4-ql a.menu-item:hover /* List item */ 
  38.         {  
  39.             color#FFF;  
  40.             background#073D7D;  
  41.         }  
  42.   
  43.         .s4-ql ul.root > li.static
  44.         {  
  45.             max-height2em;  
  46.             overflowhidden;  
  47.             transition: max-height 1s linear;  
  48.         }  
  49.   
  50.        .s4-ql ul.root > li.static:hover 
  51.        {  
  52.             max-height500px;  
  53.        }  
  54.     </style>  
category option in sharepoint

Summary

As described in this article, there are two ways to implement an accordion in SharePoint 2010 (Current Left Navigation).

Reference:

http://www.c-sharpcorner.com/UploadFile/sagarp/accordion-style-left-navigation-using-jquery-and-css-in-shar688/

SharePoint 2010 - Moving Sites and Solutions

Good Article by Jean Paul

In the life span of a SharePoint Deployment, there are sometimes a requirement  to move the site from one location to another.

Types of Moving
There are various types of moving involved.

  1. Moving within the Site Collection
  2. Moving outside the Site Collection
  3. Moving outside the Web Application
  4. Moving outside the Servers
In this article I would like to explore the shortest path available to achieve the scenario.

1. Moving within the Site Collection
Here you are moving one site to another site, within the same site collection. Please note that the content database is the same in this case.

Share1.jpg

This movement could be faster since there is only one URL change required in the background.

You can use the following solution: Content and Structure

Open Site Settings then select "Content and Structure" then select the Site then select "Use Copy / Move action".

Share2.jpg

You will be prompted with the destination site.

2. Moving outside the Site Collection
Here you are moving the site from one site collection to another site collection. Here the content database involved will be multiple & requires some real effort.

Share3.jpg

The common solution for this scenario is: Export & Import.

We can export the source site:

Export-SPWeb -Identity http://server/site -Path c:\export\site.cmp

Then we can import the file at a destination site:

Import-SPWeb -identity http://server/destsite -path c:\export\site.cmp

Before importing, you need to create the destination site with the same template as the source.

Please note that there are 2 types of Export commands:

  1. Export-SPWeb for exporting the site
  2. Export-SPSite for exporting the site collection
Similarly, Import commands are:
  1. Import-SPWeb for importing the site
  2. Import-SPSite for importing the site collection
  3. Moving outside the Web Application
3. Moving outside the Web Application
In this case we can use Step 2 and copy the exported file to the destination web application accessible path.

Share4.jpg

4. Moving to outside Servers

In this case we can use Step 2 and copy the exported file to the destination server accessible path.

Share5.jpg

Things to remember after Move
The following are the check list items after a site collection move:

  • Ensure the home page is correct
  • Ensure lists and libraries are copied
  • Ensure sub sites
  • Ensure permissions especially in top-level site
  • Ensure Features are activated
Since the move operation is Copy & Delete, it is recommended that the delete is done only after:
  1. Ensuring destination site creation
  2. Backing up source site files
There are sophisticated tools available in the market to facilitate copy/move/migration operations. Purchasing them would be a good idea if it saves time, cost & energy.

References

http://technet.microsoft.com/en-us/library/ee428301(v=office.14).aspx

Summary

In this article we have explored the Moving Site scenario & preferred solutions. I am attaching the PowerShell scripts associated.


Reference:

http://www.c-sharpcorner.com/UploadFile/40e97e/sharepoint-2010-moving-sites-and-solutions/
 

Usage Reports in SharePoint

Nice post by Ayshwarya Ramakrishnan explained in detail comparing versions in Sharepoint.

Reports on usage has been a part of the SharePoint platform for a long time now.

The following table gives an overview of the OOTB reports in each version.


Version Path Reports
Microsoft 2007
  • "Site" - > "Site Settings" -> "Site Collection Usage summary"
  • Site collection reports: http://sitecollection/_layouts/SpUsageSite.aspx
  • Site reports: http://sitecollection/_layouts/SpUsageWeb.aspx
  • Site Usage Report: http://sitecollection/_layouts/usageDetails.aspx
  • Site Usage Summary: http://sitecollection//Usage.aspx
  • Average requests per day over past 30 days 
  • Distinct users over past 30 days
  • Distinct users yesterday
  • Requests yesterday
  • Queries Over Past 30 Days
  • Top Pages (average requests per day over past 30 days)
  • Top Users (average requests per day over past 30 days)
  • Top referring pages (past 30 days)
  • Top destination pages (past 30 days)
  • Top Queries Over Previous 30 Days
  • Requests per day (past 30 days)
  • Top referring hosts (past 30 days)
  • Search results top destination pages
SP2010
  • "Central Administration Web Analytics Reports" - "Summary"
  • "Site" - > "Site Settings" -> "Site Web Analytics reports"
  • "Site" - > "Site Settings" -> "Site Collection Web Analytics reports"
  • Total & average number of page views
  • Number of page views per day
  • Total & average number of daily unique visitors
  • Total & average number of referrers
  • Total & average number of search queries
  • Number of Site Collections
  • Top pages
  • Top visitors
  • Top referrers
  • Top destinations
  • Top browsers
  • Number of sites
SP2013
  • "Site Settings" -> "Site Web Analytics Reports"
  • Number of page views
  • Number of unique visitors
  • Number of referrers
  • Top pages
  • Top visitors
  • Top referrers
  • Top browsers
For any reports on data within the last 30 days, we can create the reports by accessing the object model using the method "GetUsageData()" of the SPWeb object (or GetUsageBlob for SP 2010).

Another way is to access the database for the reports. Microsoft, however, does not permit directly querying (and ofcourse modifying) the SharePoint databases, according to the following articles, for the scenario of getting reports beyond 30 days, this seems to be permitted.

MOSS 2007 - http://www.sharepointwithattitude.com/archives/41
SharePoint 2010 / 13 - http://msdn.microsoft.com/en-us/library/gg193966(v=office.14).aspx#MonitoringSharePoint2010_LoggingDB

In MOSS 2007, when we look at the usage details, they all get into the SharedServices databases in tables begininng with "ANL*".

Share1.jpg

We could write a query as in the following to obtain reports of our choice:
private string GetTotalsQuery(Guid SiteID)
{
    StringBuilder query = new StringBuilder();
    query.Append("SELECT ANLDay.FullDate, ANLHit.UserId,ANLUser.UserName, ANLResource.SiteGuid, ANLResource.FullUrl");
    query.Append(" FROM ANLDay WITH (NOLOCK) LEFT JOIN (ANLResource WITH (NOLOCK)");
    query.Append(" INNER JOIN ANLHit WITH (NOLOCK) ON dbo.ANLHit.ResourceId = ANLResource.ResourceId");
    query.Append(" AND ANLResource.SiteGuid = " + "\'" + SiteID.ToString() + "\'" + ")ON dbo.ANLHit.DayId = ANLDay.DayId ");
    query.Append("LEFT OUTER JOIN ANLUser WITH (NOLOCK)ON dbo.ANLHit.UserId = ANLUser.UserId");
    query.Append(" WHERE convert (Date, ANLDay.FullDate) >= DATEADD(month, -3, CURRENT_TIMESTAMP) AND ANLResource.SiteGuid IS NOT NULL");
    query.Append("  GROUP BY ANLDay.FullDate,ANLHit.UserId,ANLUser.UserName,ANLResource.SiteGuid,ANLResource.FullUrl ");
    query.Append(" ORDER BY ANLDay.FullDate ASC");
}

And invoke the query against the portal context as in the following:
using (SqlCommand command = new SqlCommand())
{
    SqlDataReader reader = null;
    command.CommandText = GetTotalsQuery(site.ID);
    command.CommandType = CommandType.Text;
    PortalContext portalContext = PortalApplication.GetContext(site.ID);
    Type ContextType = portalContext.GetType();
    System.Reflection.PropertyInfo _SQLConnection = ContextType.GetProperty("AnalyticsSqlSession", BindingFlags.NonPublic | BindingFlags.Instance);
    object SQLConnection = _SQLConnection.GetValue(portalContext, null);
    Type SQLConnectionType = SQLConnection.GetType();
    MethodInfo ExecuteSQL = SQLConnectionType.GetMethod("ExecuteReader", new Type[1] { typeof(SqlCommand) });
    reader = ExecuteSQL.Invoke(SQLConnection, new object[1] { command }) as SqlDataReader;
    table.Load(reader);
    foreach (DataRow dr in table.Rows)
    {
         dtUsageReportsResults.Rows.Add(dr.ItemArray);
     }
}
In SharePoint 2010/13, there are no SharedServices databases. The usage data goes into a separate database called "WSS_logging". This database has tables such as "AnalysisServicesRequests_Partition*", "AnalysisServicesUnloads_Partition*", "ExportUsage_Partition*", "FeatureUsage_Partition*", "ImportUsage_Partition*", "RequestUsage_Partition*", "SandboxedRequests_Partition*", "SiteInventory_Partition*", "TimerJobUsage_Partition*", "WorkflowUsageTelemetry_Partition*" and so on..

There are certain pre-defined views (see the following screenshot) on these tables, that aggregates data from the relevant partition tables and provides all data in one place.

Share2.jpg

A look at RequestUsage view data:

Share3.jpg

We would need to query these views directly from our Object model (such as in the following) to get useful report data customized to our needs.
StringBuilder query = new StringBuilder();        
query.Append("SELECT   distinct FeatureUsage.SiteUrl,FeatureUsage.LogTime, FeatureUsage.UserLogin");
query.Append(" FROM dbo.FeatureUsage LEFT JOIN");
query.Append(" dbo.RequestUsage ON dbo.FeatureUsage.CorrelationId = dbo.RequestUsage.CorrelationId");
query.Append("               where FeatureUsage.SiteUrl like '%"+siteCollURL+"%'");
query.Append(" and Datediff(day,GETDATE(),convert (Date, FeatureUsage.LogTime)) <= 30 ");
query.Append(" order by FeatureUsage.LogTime ");

One thing to keep in mind is that the data in the "ANL*" tables (in MOSS 2007) and the "WSS_Logging" tables (in SharePoint 2010) usually get deleted after some time (typically 1 month, although that is configurable). For usage details beyond 1 month, we need to either look at the IIS logs or look into the backups (if taken) of these database tables and query them.


Reference:

http://www.c-sharpcorner.com/UploadFile/3a164c/usage-reports-in-sharepoint/

Quota Templates in SharePoint 2010


A quota template consists of storage limit values that specify the maximum amount of data that can be stored in a site collection. When the storage limit is reached, a quota template can also trigger an e-mail alert to the site collection administrator. You can create a quota template that can be applied to any site collection in the farm. The storage limit applies to the sum of the content sizes for the top-level site and all subsites within the site collection.

The quota templates can also be applied to a site collection that contains sandbox solutions. The maximum usage per day can be limited and cause a warning e-mail message to be sent when the usage limit is approaching. 

The existing quota templates can be modified which allows modifying the storage limits for all the site collections that use the same quota template. The quota templates can also be deleted if necessary.

Configure Quota templates:

Go to Central administration => Application Management => Site Collections =>Specify Quota templates.

QuotaTemplate.jpg

You can modify the existing quota template or you can create a new quota template.

QuotaTemplate1.jpg 

Get all available quota templates using object model:
  • Open Visual Studio 2010. 
  • Go to File => New => Project. 
  • Select Console Application template from the installed templates. 
  • Enter the Name and click Ok. 
  • Add the following assembly.

    Microsoft.SharePoint.dll
  • Add the following namespace.

    Using Microsoft.SharePoint ;
    Using Microsoft.SharePoint.Administration ;
  • Program.cs looks like the following.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Administration;namespace QuotaTemplates
    {
        class Program    {
            static void Main(string[] args)
            {
                //Get all the quota templates              SPWebService contentService = SPWebService.ContentService;
                foreach (SPQuotaTemplate quotaTemplate in contentService.QuotaTemplates)
                {
                    long StorageMaximumLevel = (quotaTemplate.StorageMaximumLevel) / (1024 * 1024);
                    long StorageWarningLevel = (quotaTemplate.StorageWarningLevel) / (1024 * 1024);
                    double UserCodeMaximumLevel = (quotaTemplate.UserCodeMaximumLevel);
                    double UserCodeWarningLevel = (quotaTemplate.UserCodeWarningLevel);
                    Console.WriteLine("Name: {0},QuotaID: {1},StorageMaximumLevel: {2}MB,StorageWarningLevel: {3}MB,UserCodeMaximumLevel: {4}MB, UserCodeWarningLevel: {5}MB ", quotaTemplate.Name, quotaTemplate.QuotaID, StorageMaximumLevel, StorageWarningLevel, UserCodeMaximumLevel, UserCodeWarningLevel);
                }
                Console.ReadLine();
            }
        }
    }
  • Build the solution.
  • Hit F5.
Note:

SPWebService - Used to represent a Web service that contains one or more Web applications. This Web service allows a Web browser to access the content in SharePoint sites.

SPWebService.ContentService - Gets the Web service associated with the content application.

SPQuotaTemplate - Used to represent a reusable definition of a quota that is applied to SharePoint sites in the deployment. 

Get all available quota templates using powershell:
  • Go to Start => All Programs => Microsoft SharePoint 2010 products => SharePoint 2010 Management Shell. 
  • Run as an administrator. 
  • Run the following script.

    $contentService =[Microsoft.SharePoint.Administration.SPWebService]::ContentService
    foreach ($quotaTemplate in $contentService.QuotaTemplates)
    {
        [long]$StorageMaximumLevel = $quotaTemplate.StorageMaximumLevel
        [long]$StorageWarningLevel = $quotaTemplate.StorageWarningLevel
        [double]$UserCodeMaximumLevel = $quotaTemplate.UserCodeMaximumLevel
        [double]$UserCodeWarningLevel = $quotaTemplate.UserCodeWarningLevel
        write-host Name: $quotaTemplate.Name ,QuotaID: $quotaTemplate.QuotaID,StorageMaximumLevel: $StorageMaximumLevel,StorageWarningLevel: $StorageWarningLevel ,UserCodeMaximumLevel: $UserCodeMaximumLevel UserCodeWarningLevel: $UserCodeWarningLevel
    }
Create new Quota template through UI:

Template Name:
  • Select "Create a new quota template".
  • Template to start from - select [new blank template] option from the drop down menu.
  • New template name - Enter the name of the new quota template.
Storage Limit Values:
  • Select "Limit site storage to a maximum of" and enter the value.
  • Select "Send warning E-mail when site collection storage reaches" and enter the value.
Storage Limit Values:
  • Enter the value for "Limit maximum usage per day to".
  • Select "Send warning e-mail when usage per day reaches" and enter the value.
  • Click on Ok.
Create new Quota template using object model:

            //Create a new quota template
            SPQuotaTemplate newQuotaTemplate = new SPQuotaTemplate();            newQuotaTemplate.Name = "New Quota Template";            newQuotaTemplate.StorageMaximumLevel = (150 * 1024) * 1024;            newQuotaTemplate.StorageWarningLevel = (100 * 1024) * 1024;            newQuotaTemplate.UserCodeMaximumLevel = 300;            newQuotaTemplate.UserCodeWarningLevel = 300;            SPWebService contentService = SPWebService.ContentService;            contentService.QuotaTemplates.Add(newQuotaTemplate);            contentService.Update();

  • Build the solution.
  • Hit F5.
Create new Quota template using powershell:

$newQuotaTemplate = New-Object Microsoft.SharePoint.Administration.SPQuotaTemplate
$newQuotaTemplate.Name = "New Quota Template"
$newQuotaTemplate.StorageMaximumLevel = (150 * 1024) * 1024
$newQuotaTemplate.StorageWarningLevel = (100 * 1024) * 1024
$newQuotaTemplate.UserCodeMaximumLevel = 300
$newQuotaTemplate.UserCodeWarningLevel = 300
$contentService =[Microsoft.SharePoint.Administration.SPWebService]::ContentService
$contentService.QuotaTemplates.Add($newQuotaTemplate)
$contentService.Update()

Edit a Quota template through UI:

Template Name:
  • Select "Edit an existing template" and choose the template to be edited.
Storage Limit Values:
  • Select "Limit site storage to a maximum of" and enter the value.
  • Select "Send warning E-mail when site collection storage reaches" and enter the value.
Storage Limit Values:
  • Enter the value for "Limit maximum usage per day to".
  • Select "Send warning e-mail when usage per day reaches" and enter the value.
  • Click on Ok.
Edit a Quota template using object model:

            // Edit a quota template
            SPWebService contentService = SPWebService.ContentService;
            SPQuotaTemplate quotaTemplate = contentService.QuotaTemplates["My quota template"];
            quotaTemplate.Name = "Updated quota template";
            quotaTemplate.UserCodeMaximumLevel = 500;
            quotaTemplate.UserCodeWarningLevel = 500;
            contentService.Update();
        
Edit a Quota template using powershell:

$contentService =[Microsoft.SharePoint.Administration.SPWebService]::ContentService
$quotaTemplate = $contentService.QuotaTemplates["New Quota Template"];
$quotaTemplate.Name = "Updated quota template"
$quotaTemplate.UserCodeMaximumLevel = 500
$quotaTemplate.UserCodeWarningLevel = 500
$contentService.Update()

Delete a Quota template through UI:

Template Name:
  • Select "Edit an existing template" and choose the template you want to delete.
  • Click on Delete.
  • Quota template will be successfully deleted.
Delete a Quota template using object model:

            // Delete a quota template
            SPWebService contentService = SPWebService.ContentService;
            contentService.QuotaTemplates.Delete("Updated quota template");        

Delete a Quota template using powershell:

$contentService =[Microsoft.SharePoint.Administration.SPWebService]::ContentService
$contentService.QuotaTemplates.Delete("Updated quota template")

Assign the quota template to the site collection through UI:

Go to Central Administration => Application Management => Site Collections =>Configure quotas and locks.

QuotaTemplate2.jpg 

QuotaTemplate3.jpg

QuotaTemplate4.jpg

You can assign the quota template to a site collection by selecting the quota template in the Current quota template drop down menu [Site Quota Information].

Assign the quota template to the site collection using object model:

            //Assign the quota template to the site collection
            SPWebService contentService = SPWebService.ContentService;
            SPQuotaTemplate quotaTemplate = contentService.QuotaTemplates["My Custom Quota template"];
            using (SPSite site = new SPSite("http://servername:1273"))
            {
                site.Quota = quotaTemplate;
            }

Assign the quota template to the site collection using powershell:

$contentService =[Microsoft.SharePoint.Administration.SPWebService]::ContentService
$quotaTemplate = $contentService.QuotaTemplates["New Quota Template"]
$site = Get-SPSite "http://serverName:1273"
$site.quota=$quotaTemplate 
(or) 
$Url="http://serverName:1273"
Set-SPSite -Identity $Url -QuotaTemplate $quotaTemplate

Reference:

http://www.c-sharpcorner.com/uploadfile/anavijai/quota-templates-in-sharepoint-2010/

Throttling Limits in SharePoint 2010


Throttling is a new feature in SharePoint 2010 lists. It allows SharePoint administrators to impose limits on the number of items returned by list queries from a list.

Now we will see this setting step-by-step.

Open the SharePoint 2010 Central Administration website.

application management
                                                                              Image 1.

Click here Application Management.

manage web application
                                                                              Image 2.

Click Manage web applications here.

Manage Web application here
                                                                              Image 3.

Select your SharePoint site then click on General Settings then click on Resource Throttling.
It may be a you can get the following screen after clicking here.

Click on Resource Throttling
                                                                                 Image 4.

No need to worry. Use the following procedure.

Open SharePoint 2010 Management PowerShell and use the following code:

$w = get-spwebapplication http://Site_URL
$w.HttpThrottleSettings
$w.Update()


Now again select your SharePoint site then click on General Settings then click on Resource Throttling.

Resource Throttling
                                                                     Image 5.

General Setting
                                                                            Image 6.

backword compatible
                                                                              Image 7.

Do the settings as you want.

The following is the description of all settings:
  • List View Threshold: Defaults to 5000.

  • Object Model Override: Yes/No radio buttons. The default value is Yes.

  • List View Threshold for Auditors and Administrators: Defaults to 20000.

  • List View Lookup threshold: Defaults to 6.

  • Daily Time Window for Large Queries: Check this option that, when enabled, allows setting of a start time and a maximum duration.

  • List Unique Permissions Threshold: Defaults to 50000.

  • Backward-Compatible Event Handlers: On/Off radio buttons. Defaults to Off.

  • HTTP Request Monitoring and Throttling: On/Off radio buttons. Defaults to On.

  • Change Log: Defaults to 60 days after which log entries are deleted. Can be set to Never.

Reference:

http://www.c-sharpcorner.com/UploadFile/rahul4_saxena/throttling-limits-in-sharepoint-2010/


Wednesday, 3 December 2014

Two level approval workflow in sharepoint designer 2010


Issue :-
It's needed to create two level approval 
 
Solved by SharePoint designer 


https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheI-muLrbZMsFKw0t4DDR32K9RWfLK2D59Luwab1Sz4stupeGjNMecVSxRq1rF6OATFE7NRICJ9AfIelYhiM6NG482g82W4atNi734Up5kyj8lTMQzsROfHS35bJvlSbD9Yy5d_GZw9po/s1600/5.png



* Create two variables that hold users for first and second manager.
   Find Manager of current item then set variable manager 1 
   Find Manager of manager 1  then set variable manager 2
* Log to Workflow history 
* At first manager Approval 
   we will set variable IsItemApproved = true if approved and 
   set variable IsItemApproved = false if rejected

 https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdz5NzkAj_epeWFezNbeC5CPwEtL_bUaxJ7cmNCfUKv0p56HhTJZaZWeddXuQ_-2mEQXRzBKUM8I9Boz6Zpu9pFfbm2ofFet9uDpvP2-cdrXcgc2m5tI-qyzIjp7KIDB0-7NnjklC6gnI/s1600/7.png






 https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizdhqL5beCkRXOkCqAAVCGAL_i5HDsr6Few6m2DgHD-ThpIG84z1mm77nuXac8Pw7_IIFw_gUI9hgQXj3xqbQbOJ6zv_GV9q1zybZtLPkFDZUXbpOyT5H7q9tvkw57a63clTj1iUg1JRE/s1600/8.png



 https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFBmCvnNLCbRMtrAActOrYExWaeG-Xxd2Wbk7DgMzjvshR8IS2I5RgHbGl-nxHmhiorM7Q2Ia_VRseGFGgw6GaBu3CvXlVMOR2O5R4h2T899YzBdcaxskLWGbXgbJt5I-t40bVxvktOaQ/s1600/6.png







Reference:

http://sharepointegyptianstyle.blogspot.in/2012/10/two-level-approval-workflow-in.html