Monday, February 27, 2012

Powershell alternative of stsadm -o migrateuser

Powershell alternative of stsadm -o migrateuser -oldlogin domain\oldid  -newlogin domain\newid  -ignoresidhistory

I found the following with the help of MSDN techies

Move-SPUser [-Identity] <SPUserPipeBind> -NewAlias <String> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-IgnoreSID <SwitchParameter>] [-WhatIf [<SwitchParameter>]]

Sunday, February 26, 2012

Change DisplayName after Windows ID change

In my clients  SharePoint 2010 my sites application, we were facing a strange issue. Our MySite app is integrated with enterprise AD and importing most of the properties from it. Few the users first name / last name changed recently which made changes in their AD Ids. The changes flown to user profile during next sync operation. We also executed the following MigrateUser command updates the user profile store for this user
stsadm -o migrateuser -oldlogin domain\oldid  -newlogin domain\newid  -ignoresidhistory
This resolved all the issues except the "Displayname at the top navigation still shows old name"....
Hours .... Days... tried all sorts of combinations .... At last I found the right combination
  • Process the name changes by issuing user migration (stsadm -o migrateuser)
  • Sets the ignore is active flag and deletes all profile sync log info (stsadm -o sync -ignoreisactive 1)
  • Changes the profile full sync timer job schedule temporarily  (stsadm -o sync -deleteolddatabases 0)
  • Executes profile full sync timer job

WOW Im excited :)

Saturday, February 11, 2012

Styling of Blog listing displayed in OOTB Blog site


There is an easy way to update Blog listing displayed in OOTB Blog site


Basically this is an XMLViewer webpart driven by the Blog.xsl file saved at 14Hive\Template\Layouts\XSL. To implement this


1. copy the Blog.xsl file locally and modify according to our needs
2. upload the modified xsl into sites style library
3. specify the XSL Link property under the Advanced property group of the web part

Saturday, January 7, 2012

Quick way to dump UPS into a CSV file

Have you ever asked to get a CSV dump of user profiles from your SharePoint User Profile Service application....?


lets try this Powershell script 


$outfile = "c:\UserProfiles.csv"; 
$arProperties ="Accountname","FirstName","LastName","Workphone","Department","Title"; 
$mySiteUrl = "https://mysite.nilaa.com/"  
$site = new-object Microsoft.SharePoint.SPSite($mySiteUrl);  
$serviceContext = Get-SPServiceContext $site 
$upm = New-Object  Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext)

$ProfileManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext)  
$AllProfiles = $ProfileManager.GetEnumerator()


$header = [string]::join("`t",$arProperties); 
$header | Out-File -FilePath $outfile -Encoding Unicode


$AllProfiles | ForEach-Object {  
  foreach($p in $arProperties){ $arProfileProps += $_.Item($p) + "`t"; } 
  $results = [string]::join($delim,$arProfileProps); 
  $CleanResults = $results.Replace("`n",''); 
  $CleanResults = $CleanResults.Replace(","," ");    
$CleanResults | Out-File -Append -FilePath $outfile -Encoding Unicode 
Remove-Variable -Name arProfileProps; 
    }

$site.Dispose()

Sunday, January 1, 2012

Content types ordering in a document set


One of the new capabilities of SharePoint 2010 is the "Document Set" feature. 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.

There is a minor issue if  selecting multiple content types into a document set while configuring the document set settings, and chose the content types, --- SharePoint places them alphabetically. Crazzy rite...?

If we don't want the document content types to be available on a library level, only inside the document set we canyt do it On a library level. We can configure this after a document set is created in the library (through 'change new button order'), but how can this be done on the content type level? good question right...

I fixed it in a tricky way - I created a document set by adding one content type at a time and saving it.

As part of creating a document set of 3 content types (First, Second , Last) in the given order 

  1. I created a document set content type (MyTest) by adding content type First. Then saved doc set.
  2. I opened that doc library and added MyTest content type to it
  3. Created a test document set of type MyTest. Removed the test doc set
  4. Opened document set content type (MyTest)  and added next content type Second. Saved it
  5. Created a test document set of type MyTest. Removed the test doc set
  6. Opened document set content type (MyTest)  and added next content type Last. Saved it
This worked perfect

Friday, October 21, 2011

Groups available in different site collections


Is it possible that I create a group that is available to assign permission to, under different site collections ?

You may not be able to create a group avaialable in multiple site collections.

The nearest possible option is - you can set User Policy on a web application which would allow you to set the following permission types in all its site collections.

  •  Full Control - Has full control.
  •  Full Read - Has full read-only access.
  •  Deny Write - Has no write access.
  •  Deny All - Has no access.


You can select individual AD users / AD security groups as part of setting up web app user policy from Central Admin...

Sunday, October 16, 2011

Link a document to a document set


Do you want some other documents in your document set without uploading it???
  1. Edit your document set content type 
  2. Add a new content type "link to documents".

This would help you to add any number of document references in your Document Set by creating Document Links.