Posts

Showing posts with the label SharePoint

SharePoint 2010 Managed Accounts

Image
When you try to add a managed account to SharePoint 2010, it was throwing a error “The specified user DOMAIN\SPFASTContentAdmAppPool could not be found. Some or all identity references could not be translated.” But the user exists in the active directory. When I investigate further I found out that SharePoint does not accept user names which are more than 20 characters in length. So new rule to the pre-installation documentation. “Manage account ids should be less than 20 characters”.

Publishing Pages : check-in file programmatically

One of the common scenarios when working with content migration is to handle the files checked out by other users. Following code is written to check-in all files check out by any users. class Program { static void Main( string [] args) { Console .WriteLine( "Please enter site url" ); using ( SPSite site = new SPSite ( Console .ReadLine())) { using ( SPWeb web = site.OpenWeb()) { PublishingPageCollection publishingPages = PublishingWeb .GetPublishingWeb(web).GetPublishingPages(); foreach ( PublishingPage page in publishingPages) { SPFile file = page.ListItem.File; if (file.CheckedOutByUser != null ) { Console .WriteLine( "The page {0} is check out by user {1}. Check-in in to take control." , file.Title, file.Ch...

How to convert a windows user name to claims user name using PowerShell

#read the user name $claimsUserID = read-host -prompt ‘Enter windows user name in format DOMAIN\UserName :’ #convert the user name to claims id $claimsUserID = New-SPClaimsPrincipal -Identity $claimsUserID -IdentityType WindowsSamAccountName $claimsUserID = $claimsUserID.ToEncodedString() #display the claims id write-host ‘Claims user ID is ‘ $claimsUserID