Wednesday 25 January 2017

Create Multiple Document libraries from Custom template using PowerShell.

Below PowerShell Script will create multiple document libraries using custom Template.

In My case custom template name is Farm Template.



Add-PSSnapin "Microsoft.SharePoint.Powershell"

#create a subsite using blank Template

$WebAppUrl="https://SharePoint.com/Sites/TEST"

#->SubSite1<-
$SubSiteTitle1 = "Subsite"
$SubSite1Url = "Subsite"
New-SPWeb –url $WebAppUrl"/"$SubSite1Url -name $SubSiteTitle1 -Template "STS#1" –AddToTopNav –UseParentTopNav

#load the custom template to new subsite

$site = Get-SPSite https://SharePoint.com/Sites/TEST
$web = Get-SpWeb https://SharePoint.com/Sites/TEST/Subsite

$custTemplate = $site.GetCustomListTemplates($web)

#Verify the custom template name

$custTemplate | select name

write-host "Loading powershell module" -ForegroundColor Red

# specify the source and destination sites
$sourceWeb = "https://SharePoint.com/Sites/TEST";
$DestinationWeb = "https://SharePoint.com/Sites/TEST/Subsite";


# get the source and destination sites web objects
$sourceWebObj = Get-SPWeb $sourceWeb;
$DestinationWebObj = Get-SPWeb $DestinationWeb;

#creating new document libraries using custom template.

$listTemplate = [Microsoft.SharePoint.SPListTemplateType]::"FarmTemplate"
$DestinationWebObj.Lists.Add("01","My Doc Library",$custTemplate["FarmTemplate"]);
$DestinationWebObj.Lists.Add("02","My Doc Library",$custTemplate["FarmTemplate"]);
$DestinationWebObj.Lists.Add("03","My Doc Library",$custTemplate["FarmTemplate"]);
$DestinationWebObj.Lists.Add("04","My Doc Library",$custTemplate["FarmTemplate"]);
$DestinationWebObj.Lists.Add("05","My Doc Library",$custTemplate["FarmTemplate"]);

Happy SharePointing :)

Monday 23 January 2017

SharePoint 2013 : Unable to search for a document/ file in search results


Sometimes, when we try to search for a file and we don't get a result. We thought that file is not available on the site or may be search crawl will take sometime to crawl it.

ISSUE:

File is uploaded and checked in into SharePoint even search crawl is idle. Still no search result.



CAUSE:


If you check crawl logs you can see that the file has been deleted by gatherer.


FIX:

1. Do an index reset.
2. Do a Full Crawl on local SharePoint site content source.

This help the file or content to get back in the index.

Hope it helps:)

Happy SharePointing :)


Tuesday 17 January 2017

Step by Step installation of Cumulative Update on SharePoint Farm.

This post will guide you with steps on how to install cumulative update on your SharePoint Farm.

Assume you have 4 servers in your farm. 2 APP and 2 Web front end.
APP1 is hosting your central admin. Also take a note of current SharePoint build number from
Manage Server on farm under system settings.

So lets get started with steps:-

1. Download your latest Cumulative Update or the update you want to install from Microsoft official site.

2. Once downloaded, copy paste it across all servers in farm.

Note: Sometimes we also have file with .cab extension so make sure you keep application file(.exe) and .cab file in same folder.

3. We always start with the server that host Central Administration in our case it was APP1. So we run the exe file on app1.

4. After installing it on APP1. Then we go ahead with APP2, after that WFE 2 and lastly WFE1.

5. Once installation of Cumulative update done on all servers. Go to APP1 server and Run SharePoint Configuration Wizard.

6. You should run it in same way you installed Cumulative update.

7. After successful completion of SharePoint Config wizard. Go to Manage Server on farm under system settings. It will have the new build value.

Hope it helps:)

Happy SharePointing :)


Unable to edit any fields in User Profile Application.


You have created a new user profile service application and using old Profile DB.

So now when you search for user in manage user profile you get the result but you are unable to edit or check user's profile  property.

Even if this happens with UPA connection.

Solution:

Go to you internet explorer  and click on tool or settings icon.

Click On Compatibility view settings.



Now add your URL /central admin name to it.





Click OK and your page will be refreshed.

Now you will be able to edit the User properties.


Hope it helps :)

Happy SharePointing :)