Friday 7 March 2014



As part of the summary script I use the following code to get the SharePoint 2010 build version. This identifies which CU or Service Pack has been installed.
There are a couple of ways for getting the build version:
1. Using Central Administration
It is of course possible to get the build version using central administration by going to ‘Central Administration –> System Settings –> Manage servers in this farm’


image



2. Using get-spfarm
You can use the following line of code to get the buildversion

get-spfarm | select BuildVersion
image
3. Using [Microsoft.SharePoint.Administration.SPFarm]::Local
This command outputs the same values as get-spfarm.
([Microsoft.SharePoint.Administration.SPFarm]::Local).buildversion
image
Use .tostring() to get the version as string.
image
 Cleaning up deleted databases in SharePoint

A service application database was deleted in SQL Server Management Studio. After a while, I noticed errors in the event viewer on the WFE and ULS logs complaining that SharePoint was not able to login to the database that I deleted. Obviously, SharePoint still thought that the database existed so I needed to find a way to remove it.

PowerShell to the rescue.
Solution

Using PowerShell, run the following command:

                 Get-SPDatabase | where {$_.exists -eq $false}


This will list all databases in SharePoint that no longer exist on the database server. If you are happy with the result and wish to remove the orphaned databases, run the following command:

                Get-SPDatabase | where {$_.exists -eq $false} | foreach {$_.delete()}


All orphaned databases should now be removed and SharePoint should stop complaining about being unable to login to the non-existent database.

Thursday 6 March 2014


Site collection Backup/Restore SharePoint Management Shell commands


There are a lot of ways to take backup of a Site collection/Web application but frequently used method is using SharePoint Management Shell.

1) Backup Command:

         Backup-SPSite -Identity http://ABC:2020 -Path C:/Mybackups/Mywebapp.bak -Force

Where http://ABC:2020 is the URLof the desired web application/site collection for taking backup and C:/Mybackups/Mywebapp.bak is the path to the physical drive where want to keep the backup.

2) Restore Command:

         Restore-SPSite -Identity http://XYZ:3030 -Path C:/Mybackups/Mywebapp.bak -Force

Now http://XYZ:3030 is the URL of desired web application/site collection and C:/Mybackups/Mywebapp.bak 
is the location of backup.


Wednesday 19 February 2014

U2U CAML Query Builder for SharePoint Server 2010

Send an email to group of multiple people from designer

SharePoint designer really helps us to simplify a basic need to sending an email with formatting options and by checking conditions.

However when it comes to sending an email to multiple people from list item, then comes the problem. If you have defined a column which is multiuser selection or even a group selection in people picker, that column does not show up in the list of the To in SharePoint designer.

Take an example, I have an assigned to column as a multiple people and group picker.



So if you go to a SharePoint designer and open the send email option and check out workflow lookup field and try to find out this Assigned to column, it does not show up there.



So we cannot send an email to people picker field if we have that field as multi user and group picker. 

I have couple of workarounds for this. I will explain both of them. But I would recommend going with second option. 

First we need to understand that if you assign hard core values in to TO email section, it sends an email. I mean try to use different users email address and couple of SharePoint Groups or even active directory distribution lists. It sends an email. 

So problem is not that SharePoint Designer cannot send an email, the problem is it does not recognize the field which has multi select user or group in it. We have to somehow find a way to tackle this.

So the first option, change your multiple people and group picker to have a single selection and user only. Open workflow designer, change the To field to have a look up to that Assigned to field. Save the workflow. Come back to the list and now again change AssignedTo filed to the multi user and group filed. 

So now onwards even if you select different users and groups, it will send an email.

The big problem with this approach is that if you are trying to do this with existing list which already has data in it, then you will run into a problem of losing other users defined in the people picker column. Because when you change multi select to a single user selection, only first user is preserved, rest all will be discarded. So that can be a big loss and almost no one would want this.

This approach works when you are starting fresh with the new list.

So what is the best way? Well, the best way is to use this second option.

In your workflow, define one variable. Call it EMailList and should be of type String.



Ignore other variables, I used them for other reason.

So now in an action assign Assigned to field to this EMailList variable and then use this variable as a workflow look up by taking workflow items.



And you are done.

The Server was unable to save the form at this time. Please try again in SharePoint 2013

I was working on a simple list to add the data into it . The error was not allowing me to add the data into the simple share point list .Searching on internet I came to know that restarting the "Search Host Controller Service" would solve the issue .The ideology was it was eating lot of RAM and so it has to be restarted .But since I knew this issue, in our server "Search Host Controller Service" was already disabled long back ,since we were not working on search .
                    But some how i had to solve this issue since my share point 2013 server was taking in any items.
So I decided to give a try and started "Search Host Controller Service" luckily it worked and I was able to add items to any list in the web application .

To restart "Search Host Controller Service" run the services.msc as Admin and start or restart the service

SharePoint stopped working after AD password change

There is an easy way to get rid of this issue. If you have updated your farm administrator or local machine user password then you must update all SharePoint pools User passwords in IIS.
    • Go to IIS (run as administrator)
    •  Click over application pools Select all those pools one by one containing particular user name and reset it then by clicking on advance setting.
    • After updating user names/passwords restart IIS (open CMD as administrator write iisreset or from wizard restart it).


Enjoy SharePoint once again. Best of luck.