Monday, 30 November 2015

SharePoint 2010/2013 Automatic redirect from http to https

IIS 7.0+ Microsoft URL Rewrite Module is not available by default, you must need to download and install on all SharePoint front end servers

in this example i am using url.


Microsoft URL Rewrite Module 

SharePoint Settings :

SharePoint Web application alternative access mapping must be configured properly for HTTP and HTTPS.
  1. open Central administration , 
  2. Click on application management 
  3. click on alternative Access mapping 
  4. select particular application
  5. please verify all the url for the web application

Monday, 10 August 2015

Install SharePoint 2013 with Service Pack 1 On Windows Server 2008 r2 - Offline

Install SharePoint 2013 with Service Pack 1 On Windows Server 2008 r2

·        Install windows components
Import-Module ServerManager

Add-WindowsFeature NET-WCF-HTTP-Activation45,NET-WCF-TCP-Activation45,NET-WCF-Pipe-Activation45 -Source C:\PreReq\

Add-WindowsFeature Net-Framework-Features,Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Security,Web-Basic-Auth,Web-Windows-Auth,Web-Filtering,Web-Digest-Auth,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Application-Server,AS-Web-Support,AS-TCP-Port-Sharing,AS-WAS-Support, AS-HTTP-Activation,AS-TCP-Activation,AS-Named-Pipes,AS-Net-Framework,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Web-Lgcy-Scripting,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer -Source C:\PreReq\

·         Required Restart

·         Download the Components
The list of files to download are as follows:

·         Install other pre-requisite   Contents
$SPPath = "E:\InitialDirectry"

Start-Process "$SPPath \PrerequisiteInstaller.exe"
–ArgumentList "/SQLNCli:$SPPath \PrerequisiteInstallerFiles\sqlncli.msi
/IDFX:$SPPath \PrerequisiteInstallerFiles\Windows6.1-KB974405-x64.msu
/IDFX11:$SPPath \PrerequisiteInstallerFiles\MicrosoftIdentityExtensions-64.msi
/Sync:$SPPath \PrerequisiteInstallerFiles\Synchronization.msi
/AppFabric:$SPPath \PrerequisiteInstallerFiles\ WindowsServerAppFabricSetup_x64.exe /KB2671763:$SPPath \ PrerequisiteInstallerFiles\AppFabric1.1-RTM-KB2671763-x64-ENU.exe
/MSIPCClient:$SPPath \PrerequisiteInstallerFiles\setup_msipc_x64.msi
/WCFDataServices:$SPPath \PrerequisiteInstallerFiles\WcfDataServices.exe
/WCFDataServices56:$SPPath \PrerequisiteInstallerFiles\WcfDataServices56.exe"

Tuesday, 14 October 2014

SharePoint 2013: The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered

When I am trying to open sharePoint 2013 Powershell

I am getting below error

“The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered”

Add the current user as powershell admin

Close the Power shell and open it again , now you can access it with out any error


SharePoint 2013 Installation Error AppFabric, AppFabric installation failed because installer MSI returned with error code : 1603

SharePoint 2013 Prerequisites fails with MSI Installer error code 1603 while installing AppFabric 1.1

  • Right Click “My Computer”
  • Click “Properties”
  • Go to “Advance” Tab
  • Click at “Environmental Variables”
  • Look in to System Variables.
  • Find “PSModulePath” 
  • Click “Edit”
And Verify the Entry should look like below

C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;c:\Program Files\AppFabric 1.1 
if you have different value then just just paste the above value.

Install AppFabric using below command.

Open Powershell and go to the AppFabric Path and Run the Command

\WindowsServerAppFabricSetup_x64 / i CacheClient, CachingService, CacheAdmin / gac

after executing the command , wait for few mintues and open the control pannel to see the installed programs

Friday, 26 September 2014

Network Load Balancing Using Windows Server 2012 For SharePoint 2013

Consider the Example That i have 2 Front-End server and One DNS record for Load Balance

Server Name
Front end 1
Front end 2
Load Balancer Name

SP2013-FE01 Sever

Step 1: Open Server Manager

Step 2: Click Manage on Right Top and Select “Add Role and Features”

Step 3: Leave every thing Default and Click Next

Step 4: "Select Installation Type"Leave Default and Press Next

Step 5:Selecting Destination server “Leave Default and Press Next

Step 6: “Selecting Role “Leave Default and Press Next

Step 7: “Selecting Feature “Select Network Load Balancing After checking the Check box it will prompt for Extra Features.

Step 8: Select Extra Feature Required for Network Load Balancing and Press Add Features and will return to main features screen, Press Install

Installation Process will start, Wait for Completion of installation

SP2013-FE02 Server

Open The Second Front server and Repeat the Step 1 to step 8.

Configuration of Network Load balance.

Open the Server First Server SP2013-FE01

Step 1: Open Server Manager and Click Tools and Select Network Load Balancing manager.

Step 2:   From Menu select Cluster and Sub Menu New.

Step 3: Enter the first Host Name, in current scenario I am using SP2013-FE01 and Press Connect
After connecting successfully it will add in interfaces And Press Next

Step 4: New Cluster -- > Host parameters  make sure for first node Priority  is select  1 from Drop down and Default state is to be selected as started .

Step 5: Define Cluster IP -> Press Add Button to Add cluster IP.

Step 6: Enter IP for Cluster in My Case I am using and Subnet is and Press OK

Step 7: Select the Cluster from Drop Down, (automatically selected if not selected then select manually) Enter the Full Internet name and From Cluster Operation Mode Select Multicast and press Next

Step 8: Port Rules it will select from 0 to 65535 if you want to edit it, otherwise leave as default and Press Finish.
Now you can see you Cluster , One node is already added, 

Add Second Node to the NLB Cluster

Right Click on Cluster  -"Add Host to the Cluster"

Enter Host IP and Press Connect after Press Connect it will added into interfaces.

Setting the host parameters, For This Node select priority 2 and state as "started"

Press Next and it will prompt for Ports setting , If you want to change can edit other wise leave it default.

Verify the nodes.

Wednesday, 24 September 2014

Your backup is from a different version of Microsoft SharePoint Foundation and cannot be restored to a server running the current version

Source Server:
Running on SharePoint 2010 with SP1 (Installed SP1 manually)
Version Information:

Target Server:
Running on SharePoint 2010 With SP1 (Newly configure using SharePoint 2010 With SP1 Media)
Version information:

But I was trying to restore using Power Shell I am getting the Error for version is not same.
Your backup is from a different version of Microsoft SharePoint Foundation and cannot be restored to a server running the current version. The backup file should be restored to a server with version 14.0.0....   Or later

Versions are same, that’s why I was not sure what the difference is,

I just verify the Installed Update I found at Source and Target server are different in the terms of SharePoint Updates.

  1. Download required Updates
  2. Installed on Target server
  3. Restart is required.
  4. Run the configuration Wizard
 you can Find Required Update and hot fix information at 
After that doing the above steps I am able to restore my site collection backup.

Tuesday, 23 September 2014

Restore SQL DataBase Backup On same or Different Server Using SQL Command

Most of the time i am struggling to restore to the back from interface, Different types of errors every time i need to face,  Using SQL command its more easy just have to make sure about the file names are correct and  current user have permissions to access.

You must have a Valid SQL Backup file with .bak extension, You can use this Sql command to restore the back on the same server or different Server.

Open SQL Server
Click at New Query
use the below query , just the required Parameters according to you files and locations.

Restore filelistonly from disk = 'FULL-PATH\FileName'

restore database DatabaseName
from disk = 'FULL-PATH\FileName'
move 'Logical Name for Data File to 'FULL-PATH\FileName.mdb'

move 'Logical name for Log Fileto 'FULL-PATH\FileName.ldf'

Restore filelistonly from disk = 'C:\Backups\WSS_Content_2010_Portal-Full-Database-Backup'
restore database WSS_Content_2013_portalTest
from disk = 'C:\Backups\ WSS_Content_2010_Portal-Full-Database-Backup'
move 'WSS_Content_2013_portalTest' to 'C:\Backups\WSS_Content_2013_Portal.mdf',

move 'WSS_Content_2013_portalTest_log' to 'C:\Backups\WSS_Content_2013_Portal_log.ldf'

Tuesday, 29 April 2014

Programmatically get choice values from SharePoint List

Step 1: Create a Simple Method or use Code Directly in Existing Method.

        /// <summary>
        /// Get Choice Column Value from List
        /// </summary>
        /// <param name="List"> List Name</param>
        /// <param name="Field"> Field Name</param>
        /// <returns> List<String> Containing the Choice Column Values</returns>

        public List<string> GetChoiceColumnValues(string List, string Field)
            List<string> Choices= null;
                using (SPSite site = new SPSite(SPContext.Current.Web.Url.ToString()))
                    using (SPWeb web = site.OpenWeb())
                        SPList objList = web.GetList(List);
                        SPFieldChoice field = (SPFieldChoice)objList.Fields[Field];
                        Choices= new List<string>();

                        foreach (string str in field.Choices)
            catch (Exception ex)
                Response.Write("Get Values : " + ex.Message);
            return Choices;

how to Get Values from Strings List

List<string> objFields = GetChoiceColumnValues(SPContext.Current.Web.Url.ToString() + "/Lists/ListName", "Fieldname");
            foreach (string item in objFields)


Saturday, 9 November 2013

Common and Useful PowerShell commands for SharePoint 2010/2013

Useful PowerShell commands for SharePoint

Working with SharePoint solutions
1.       Add Solution
Add-SPSolution c:\mysolution.wsp
2.       Install SharePoint Solution
Install-SPSolution  –Identity mysolution.wsp  –WebApplication http://spsite  -GACDeployment
3.       Update solution
Update-SPSolution –Identity mysolution.wsp –LiteralPath c:\ mysolution.wsp –GACDeployment
4.       Uninstall Solution
Uninstall-SPSolution –Identity mysolution.wsp –WebApplication  http://spsite  
5.       Remove solution
Remove-SPSolution –Identity MySharePointSolution.wsp
Working with SharePoint Features
1.       Install feature
Install-SPFeature “Feature Folder Name”
2.       Enable Feature
Enable-SPFeature “Feature Folder Name”  -Url  http://spsite
3.       Disable Feature
Disable-SPFeature “Feature Folder Name”  –Url  http://spsite
4.       Uninstall Feature
Uninstall-SPFeature “Feature Folder Name”
5.       Get All Features in the Farms
In result it will provide you all feature with Display name, Id and scope. You can apply sorting, grouping on it
Get-SPFeature | Sort -Property DisplayName/id/scope
Get-SPFeature | Sort -Property Scope,DisplayName | FT -GroupBy Scope

6.       Get All  Features in Site Collection
Get-SPFeature -Site http://yousitecolletion
7.       Get All features in Web 
Get-SPFeature -Web http://youweburl
Back-Up and Restore Site Collection
1.       Back Up Site Collection
             Backup-SPSite -Identity http://yousitecolletion -Path  c:\sitebackup.bak -Force
2.       Restore SiteCollection
Restore-SPSite -Identity http://yousitecolletion -Path c:\sitebackup.bak  -Force

Thursday, 7 November 2013

SharePoint 2010 / 2013 Site Save As Template not available or not working

One of the best feature in SharePoint is saving site as template is missing or some time you got error. I face this issue many time.

  1. if you enable Publishing features you can see save as template option in site settings.
  2. some time due to Custom features you can save site as Template. Especially SharePoint 2013 you will got error "Some thing went wrong you can not save site as template" in log you can see this type of error 
       Microsoft.SharePoint.SPException: The "Save site as template" action is not supported on  this site.

its Difficult to identify what an issue , you have to go through the logs and based on Correlation ID you have to identify what's the error.

  1. if publishing feature is enable , and your are not using any publishing feature , disable it , after disable the feature you can see the "Save as Template " in site settings or 
  2. if you require the Publishing feature then you can Edit the Url  and add  "/_layouts/15/savetmpl.aspx" at the end in SharePoint 2013 and add  "_layouts/savetmpl.aspx"  in SharePoint 2010. e.g
  3. using SharePoint Designer you can also change these settings. Open Site in SharePoint Designer , Default page at top right corner you can see the Site settings option , Click on it , and change SaveasTemplate value to true.

Wednesday, 6 November 2013

Business Connectivity services using Visual Studio 2010

Business Connectivity services using Visual Studio 2010
Using SharePoint Designer you can connect and communicate to external Database or Data. But you don’t have much control using SharePoint 2010 designer.

Other option is you can use Visual studio to write custom code to achieve External Content type. Using Custom code you have full control over the business logic to external Data Sources.
How it Works

BDC Runtime API which manipulate the External data, External content type behave similar like a SharePoint content types, you can manage security on external Lists, Default farms for add, edit, and delete are created , List are available for BI solution, Data in Lists are available for Search.

How to Create BCS Solution in Visual Studio 2010
1.       First we need to identify the Data Store/Database which we want to use as external Content type, in this example I am using very simple table with the name of Customers which contain only 3 columns. Database Table script is
Create TABLE [dbo].[Customers](
   [CustomerID] [int] IDENTITY(1,1) NOT NULL,
   [CustomerName] [nvarchar](50) NULL,
   [CusAddress] [nvarchar](50) NULL,
   [CustomerID] ASC

2.       Create new project using Visual studio 2010
3.       Select SharePoint project templates
4.       Select Business connectivity as Project type, Project name to solution and project and Press Ok

5.       Business connectivity Solution can only deployed as Farm solution, select the Site URL and Press finish button.

6.       After Finish button Visual Studio 2010 will Create Some structure for you

7.       Rename the File Entity1.cs to Customers.cs
This is entity Class; here we need to define entity like in my case entity is Customer

8.       Open the Code View of Customer.cs

9.       Remove the existing properties And write new properties based on your entity.

 private int _ID;
        public int ID
            get { return _ID; }
            set { _ID = value; }
        private string _CustomerName;

        public string CustomerName
            get { return _CustomerName; }
            set { _CustomerName = value; }
        private string _CusAddress;

        public string CusAddress
            get { return _CusAddress; }
            set { _CusAddress = value; }

10.    Now open the designer mode of BDC Model ,
11.    Rename the Model name. right click on Model -> select properties -> Change name to CustomersModel (can choose any name)
12.    Select the identifier -> open properties and rename to ID and change Type Name to System.Int32. As an Example ID is identifier