Get the quick links for the specified user using SharePoint 2010 web service in powershell

Steps Involved:
  1. Open SharePoint 2010 Management Shell by going to Start | All Programs | SharePoint | Microsoft SharePoint 2010 Products | SharePoint 2010 Management Shell (Run as Administrator).
  2. Run the following script.

Powershell Script:

 
 
##Get the quick links for the specified user using SharePoint 2010 web service in powershell
$uri="http://serverName:10736/sites/ECT2/_vti_bin/UserProfileService.asmx?wsdl"
## $accountName is a string that contains the account name for which you need to get all the colleagues
$accountName="domainName\userName"


## Web Service Reference - http://Site/_vti_bin/UserProfileService.asmx
$userProfileWebServiceReference = New-WebServiceProxy -Uri $uri -UseDefaultCredential
$quickLinks=$userProfileWebServiceReference.GetUserLinks($accountName)

## Creates an GetUserLinks.xml file in the D:\ which containsall the links for the specified $accountName
$output = New-Object -TypeName System.IO.StreamWriter -ArgumentList "D:\GetUserLinks.xml", $false
$output.WriteLine("<?xml version=""1.0"" encoding=""utf-8"" ?>")
$output.WriteLine("<QuickLinks>")
foreach($link in $quickLinks)
{
$name=$colleague.Name
$group=$colleague.Group
$privacy=$colleague.Privacy
$url=$colleague.Url
$id=$colleague.ID

$output.WriteLine("<Link Name=""$name"" Group=""$group"" Privacy=""$privacy"" Url=""$url"" ID=""$id"" >")
$output.WriteLine("</Link>")
}
$output.WriteLine("</QuickLinks>")
$output.WriteLine()
$output.Dispose()


Output:


output.jpg