Pathik's Blog

Start here

Apress Author


Develop on Yammer: Social Integration for Modern Business Applications

Develop on Yammer is your guide to integrating the Yammer social network with your company’s application ecosystem.By developing custom apps and features on the Yammer platform, you can make your workplace more productive, encourage communication and feedback, and get your colleagues collaborating across a range of platforms, including SharePoint, ASP.NET, and Windows Phone.

The book begins with an introduction to the development options available along with guidance on how to set up a Yammer developer account. You’ll then take your first step in Yammer integration by building a Yammer feed into a web page or other JavaScript-based client application, before diving into app creation and management on the Yammer platform.

The authors provide a deep dive into the Yammer authorization process from client-side and server-side perspectives, and you’ll find out how to work closely with Yammer’s data streams and its full range of development possibilities using Open Graph and Yammer’s REST API. The final chapters cover how to build Yammer integration into standalone applications for SharePoint and Windows Phone 8 with Yammer SDKs.

All chapters are illustrated with examples and sample code, and a case study follows the development of a workplace training application as the authors apply each technique, so you can see how to make the most of what Yammer has to offer.

What you’ll learn
Why develop on Yammer, and what development options are available
How to add a Yammer feed to an HTML-based application using Yammer Embed, to bring relevant news and discussions into the contexts where they matter
How to develop custom Yammer features for your SharePoint, Office or web applications on the client side with the Yammer JavaScript SDK
How to carry out secure authorization and authentication on Yammer
How to use Yammer Open Graph and REST APIs to posts messages, create custom activities and get data from Yammer-integrated applications
How to work with the Yammer Windows Phone 8 SDK to add Yammer functionality to a Windows Phone 8 application
Who this book is for
This book is targeted at developers with a background in .NET/C# development. Readers should be comfortable working with JavaScript.

Software architects will also find this book valuable for planning social integration across their companies’ business ecosystems.

About the Author
Pathik works as a senior SharePoint consultant for Avanade, based in the UK. He has twelve years’ experience in a range of software development technologies, including Microsoft ASP.NET, ASP.NET MVC and SharePoint, and experience in software design, architecture, and workflow automation. Pathik has an active technical blog on SharePoint at and you can find him on Twitter @pathikrawal.

2012 in review

The stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

4,329 films were submitted to the 2012 Cannes Film Festival. This blog had 32,000 views in 2012. If each view were a film, this blog would power 7 Film Festivals

Click here to see the complete report.

My Links Migration from MOSS 2007 to SP 2010- Part 2

Hi There,

I discussed about My Links migration in post 1 here  . In this post I am going to provide code snippet for migration of My links.

The actual migration process involves 2 major activities

1) EXPORT- Export My Links on MOSS 2007’s My Site (C# Code)

2) IMPORT- Import all My Links on SharePoint 2010’s My Site (PowerShell)

Export Process:

Details Steps

1) You can create a console application/Windows Applciation or WPF Application in Visual Studio 2008 with .Net Framework 2.0

2) Create an XML with links data. (By running our application on MOSS 2007 which will create an XML file)

XML format:

    <UserProfile userNames=“user1” accountName=“VM-MOSS01\user1”>
         <![CDATA[  ]]>
The actual code is provided below ( this is function you can copy to you console application). The
only one Parameter is URL- You need to provide the Central Admin URL
Code to export My links
public static void ExportUserProfiles(string url)
           //accessing the profile manager to get profile properties
           UserProfileManager profileManager = default(UserProfileManager);
           using (SPSite site = new SPSite(url))
               ServerContext serverContext = ServerContext.GetContext(site);
               profileManager = new UserProfileManager(serverContext);
           //declaration of xml file
           XmlDocument xmlDoc = null;
           XmlNode userProfilesNode = null;
                  //creating new XMl document
                   xmlDoc = new XmlDocument();
                   XmlDeclaration xmlDeclaration = xmlDoc.CreateXmlDeclaration(“1.0”, “UTF-8”, “yes”);
                   //creation first node of userprofile
                   userProfilesNode = xmlDoc.CreateElement(“UserProfiles”);
           foreach (UserProfile userProfile in profileManager)
                   //creating user profile node
                   XmlNode userProfileNode = xmlDoc.CreateElement(“UserProfile”);
                   XmlAttribute userProfileAttribute;
                   // creating username property for profile node
                   userProfileAttribute = xmlDoc.CreateAttribute(“userNames”);
                   userProfileAttribute.Value = userProfile[PropertyConstants.UserName].Value.ToString();
                   // creating accountName property for profile node
                   userProfileAttribute = xmlDoc.CreateAttribute(“accountName”);
                   userProfileAttribute.Value = userProfile[PropertyConstants.AccountName].Value.ToString();
                   ////creating myLink node in export xml file
                   XmlNode myLinksNode = xmlDoc.CreateElement(“UserLinks”);
                   QuickLinkManager linkManager = userProfile.QuickLinks;
                   foreach (QuickLink link in linkManager.GetItems())
                           XmlNode linkNode = xmlDoc.CreateElement(“Link”);
                           XmlNode linkTitleNode = xmlDoc.CreateElement(“title”);
                           linkTitleNode.InnerXml = link.Title;
                           XmlNode linkGroupNode = xmlDoc.CreateElement(group);
                           linkGroupNode.InnerXml = link.Group;
                           XmlNode linkGroupTypeNode = xmlDoc.CreateElement(“groupType”);
                           linkGroupTypeNode.InnerXml = link.GroupType.ToString();
                           XmlNode linkPrivacyeNode = xmlDoc.CreateElement(“privacy”);
                           linkPrivacyeNode.InnerXml = link.PrivacyLevel.ToString();
                           XmlNode linkUrlNode = xmlDoc.CreateElement(“url”);
                           XmlCDataSection linkValCData;
                           linkValCData = xmlDoc.CreateCDataSection(link.Url);
                       catch (Exception ex)
               catch (Exception ex)



Now for Import I am going to provide you PowerShell script to import all links for all users.

Details Steps:

1) Copy the XML file to a folder

2) Create a New ImportLinks.PS1 in the same folder and copy below code to PS1 file

$commonconfig = “links.xml”
$executingScriptDirectory = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
#region scripts body
#region snapin inclusion
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
# if snapin is not installed then use this method
[xml]$configurations = Get-Content “$executingScriptDirectory/$commonconfig” 
$site = newobject Microsoft.SharePoint.SPSite(“http://w7-pathikr:15767”)
$ServiceContext = [Microsoft.SharePoint.SPServiceContext]::GetContext($site);
$ProfileManager = newobject Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext)
#provision managed accounts
    foreach($UserProfile in $configurations.UserProfiles.UserProfile)
        Write-Host $UserProfile.accountName;
        $User = $ProfileManager.GetUserProfile($UserProfile.accountName);
        $quickLinkManager = $User.QuickLinks;
       foreach($Link in $UserProfile.UserLinks.Link)
           $quickLinkManager.Create($title, $url, $group, $null, $privacy)       


Now Run the PowerShell script on SharePoint 2010 Management Shell (Run as Administrator)

Thats all ! All Links from MOSS 2007’s My Site to SP 2010’s My Site for all users.


Manage Timer Jobs with PowerShell

In this small post lets see how you can configure Time Jobs using PowerShell. Lets say you want to enable “Activity Feed Job” which is by default “Disabled” on the Server.

a) First run below command to Get the job definition like Name, status, GUID


get-sptimerjob | sort-object name | where {$_.Name -match “ActivityFeedJob”}



Note down the Name of the job. Usually it will be <<User Profile Service Name>>_ActivityFeedJob

More details on Get-SPTimeJob visit

b) Run below command to enable Time job


Enable-SPTimerJob -Identity <<Name of Job captured in step a>>



More details on Enable-SPTimerJob visit

c) Set timer job- Schedule a time job now after it is enabled


Set-SPTimerJob “upa_ActivityFeedJob” -schedule “Every 30 minutes between 0 and 59”



More details on Set-SPTimeJob visit

that’s it

SharePoint 2010- Document Sets-Introduction


Document Set is new feature added to SharePoint 2010’s document management capabilities. This a great feature to manage different set of documents within one document library. Document Set is very similar to folder within a document library but it comes with a lot of great useful features.

Document Set enables users to group multiple documents, that support a single project or task, together into a single entity. All documents in a Document Set share the metadata and the entire set can also be versioned.

Example of Document Sets

1) If you want to have a document library named Training. Training Document Library may content below set of documents

  • Course Content
  • Presentation
  • Books for Reference
  • Hands on Lab

For this you Could easily create a new Document library and then enable Document Sets for the document library. Then you can create 4 document sets as shown in below picture

Steps to create Document Library and Document Set

  • Enable Document Set Feature (Site Collection Feature)
    • Navigate to Site Collection Feature & Enable “Document Sets” Feature as shown in below picture


  • Create a New Document Library First
    • Click on Site Action ==> More Option ==> “Document Library” from available templates


    • Enter name as “Trainings”
    • After the Document library is created, navigate to Library (Ribbon Tab) ==>Library Setting ==> Advanced Settings ==>  Content Type and select Allow Management of Content type (see below screen shot)



    • Now Navigate to
    • Trainings ==> Document Library Settings ==>
      Content Types ==> Add from existing site content types ==> Select “Document Set” Content Type from Available Site Content Types ==> Click Add ==> Click OK

      (This will associate your document library to OOB Document Sets Content Type


  • Create Document Sets within Trainings Document Library
    • With in Document Library ==> Select Document Ribbon Tab ==> Click on arrow of New Document Button ==> Select Document Set


    • Enter Name as “Course Content” and enter some description


    • Follow above steps to create below Document sets
        • Presentation
        • Books for Reference
        • Hands on Lab

Training Document Library will look like as shown in below screen shot


& each Document set view is as shown in below screen shots (Welcome Page). This page can be used to upload documents to the document set, create/define properties, assign workflow, define view.


Below is the ribbon control for document set.

Some considerations:

  • Folders are not allowed in a Document set
  • You can not use Metadata Navigation in a document set
  • No limit on number of documents in a document set however the display load is limited by list view threshold (which is 5,000 items)

In this post I explained about what is Document Sets and how to create/associate. I am going to explain about customization of Document Sets Content type, Programmatically create “Document Sets”

PowerShell Script to enable Visual Upgrade for all webs under a site collection

When you upgrade from Microsoft Office SharePoint Server 2007 to Microsoft SharePoint Server 2010, you can choose to use the Visual Upgrade feature to give site collection owners and site owners the opportunity to preserve the previous user interface temporarily

When you upgrade, either by using in-place upgrade or by using the database attach upgrade method, you can choose to use Visual Upgrade.

How to use this script

1) Copy below code to .PS1 file

2) Run the .PS1 using SharePoint 2010 Management Shell

3) Parameters to .PS1

ex: visualupgrade.ps1 1 “http://w7-pathikhr”

Param 1: 0 or 1

Param 2: URL of the Site Collection

param([int] $RestrictVisualUpgrade = 0,$siteurl)
[System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c”) | outnull
$oContentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService;
[Microsoft.SharePoint.Administration.SPWebApplicationCollection]$waColl = $oContentService.WebApplications;
$waCollNonAdmin = $waColl | whereobject {$_.IsAdministrationWebApplication -eq $FALSE}
write-host $siteurl
$siteColl = Get-SPSite $siteurl
        $siteColl.UIVersionConfigurationEnabled = $RestrictVisualUpgrade
        foreach($web in $siteColl.AllWebs)
$web.UIVersionConfigurationEnabled = $RestrictVisualUpgrade


To learn more about Visual upgrade visit