Archive for the ‘SharePoint’ Category

Steps to Remove orphan sites from SharePoint

April 28, 2015 Leave a comment

Remove Orphan sites from SharePoint Health Analyzer

1) Open Powershell and Run Test-SPContentDatabase command

Test-SPContentDatabase -Name <Database_Name> -WebApplication <URL>

This will show the IDs of the Orphan sites.

2) Run stsadm command to delete the site from the database

stsadm -o deletesite -siteId <ID> -databasename <database_name> -databaseserver <server_name> -force


How to rebuild Search Service Application in SharePoint 2010

May 31, 2012 3 comments

1) Open SharePoint Management Shell as an administrator


Delete the Search Service Application


2) Locate the GUID for the search service application by typing


Get-SPServiceApplication |?{$ -eq “<name of the search application>”}


3) Copy the names of the Databases associated with the Search Service Application

4) Run the following stsadm command


Stsadm.exe –o deleteconfigurationobject –id ‘<GUID>’

4 ) Delete the following databases from SQLManagementStudio . The exact names are copied under Step 3.





5) Delete the index files from Program Files\Microsoft Office Servers\14\Data\Office Servers\Applications


6) Go to Central AdministrationàManage Service Applications

7) Click New Search Service Application

8) Provide a name to the application and select the managed account and Click Ok

Wait for the confirmation

Configure the new Search Service Application


9) Add the existing portal address in the content sources and setup Full Crawl and Incremental crawl.

10) Run full crawl





March 27, 2012 Leave a comment

Recently I  came upon a requirement where the client  wanted the People Picker field to populate automatically with a user name depending on the some criteria and  not be able to change it.
I know I can disable the field but with the “Browse” icon a user can still change the People Picker value.
 So in order to hide the “Browse” field I went on a journey to figure out and finally found an easy way …
var divs1 = document.getElementsByTagName('a');    // Locate the "a" tag on the page
var z = 0;
for(var i =0; i < divs1.length; i++) //Loop through to find the browse icon
if(divs1[i].<a class="zem_slink" title="Internet Explorer" href="" rel="homepage" target="_blank">innerHTML</a>.indexOf('addressbook.gif') > 0) // The name of the image is "addressbook.gif"
if (z == 3)  // you have to manually count the total number of PeoplePicker on the page and target the one you want to disable
divs1[i].innerHTML = "</pre>
<img title="Browse" src="\&quot;/_layouts/images/addressbook.gif\&quot;" alt="Browse" />
<pre>"   // Append the innerHTML with display:none 

Calculate number of weekdays between two date fields

February 22, 2012 Leave a comment
Categories: SharePoint Tags:

Columns from SharePoint list are missing ( Created or Modified) in SharePoint 2010

January 31, 2012 Leave a comment

Both Created and Modified columns went missing in my site collection. I found the solution here :

Categories: SharePoint Tags:

Change the File Upload Size limit in SharePoint

December 8, 2011 Leave a comment

    1. Log in to SharePoint Server and navigate to Central Administration.
    2. On the Central Administration Page navigate to  Central Administration -> Application Management -> Manage Web Applications
    3. Highlight the web application
    4. Once there highlight the web application that you want to change and then click on General Settings
    5. On General Settings dialog, scroll to the bottom of the list and you will see the maximum upload size the default is 50MB
    6. Update that to the new size
    7. Click OK

Categories: SharePoint

Create a list in all the sites using Powershell

September 20, 2011 3 comments

Here is way to create a list based on a custom template using Powershell. The script will go through each site and create the list and add them to the Quick Launch

$GetSites = Get-SPWebApplication | Get-SPSite | Get-SPWeb -Limit ALL
foreach($getsite in $GetSites)
$listTemplate = $getsite.Site.GetCustomListTemplates($getsite)
$getsite.Lists.Add("MyList","My List",$listTemplate["MyTemplate"])
$list = $getsite.Lists["MyList"]
$list.OnQuickLaunch = $true


Make sure that custom template is uploaded in the List Template Gallery. Check out this link  if you want to add a list template using powershell