April 08, 2012

Backup/Restore of a sharepoint site using stsadm

Backup means taking copy of a sharepoint site and restore means paste to another.

There are two ways of doing this or we can say that two set of commands.
  • Backup - Restore
  • Import - Export
Both ways are having their own advantage and disadvantages.

In this article I will show you Backup and restore command.
To achieve this we will use STSADM utility. This utility is present in the below mentioned path.
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN

1.gif
I have created two web application. One is with some customization and other is blank site.

Website 1: Site with some customization having address http://spdevserver:1002/default.aspx

2.gif
WebSite 2: Blank site having address http://spdevserver:1003/default.aspx

3.gif
Now we will take the backup from http://spdevserver:1002/default.aspx and restore it to http://spdevserver:1003/default.aspx

Steps to take site Backup:

Step 1: Open Command prompt and go to location as shown in the below screenshot.

4.gif
Step 2: Write the STSADM command for taking the site backup.

stsadm -o backup -url http://spdevserver:1002/ -filename C:\Backup.bak

5.gif
This command will save Backup.bak file in C:\

This file is the complete backup for http://spdevserver:1002/default.aspx

Now next step is to Restore this backup file to http://spdevserver:1003/default.aspx

To do this we need to write the STSADM command for Restore.

RESTORE COMMAND

stsadm -o restore -url http://spdevserver:1003/ -filename C:\Backup.bak -overwrite

6.gif
Now after completing this operation we are having http://spdevserver:1003/default.aspx site which is exactly the replica of http://spdevserver:1002/default.aspx site.

Just refresh the page and you will see it.

7.gif
In this way we can take a backup of sharepoint site and restore it to another sharepoint site.

April 03, 2012

How to deploy wsp file using Visual Studio 2010 for SharePoint 2010

In SharePoint 2010 it is easy to create a .wsp file using visual studio 2010, which was previously very difficult in MOSS 2007. To deploy any solution package in any local environment in Visual Studio 2010 simply right click on the project and deploy. But to deploy the same thing in the production server we will need to deploy through .wsp file.


Steps to generate the wsp file:
 Right click on the project/solution in Visual Studio 2010 then choose package. If you are building the project/solution in debug mode then you will get the .wsp file inside the Bin\Debug folder and if you are building the project in release mode then you will get the .wsp file inside the Bin\Release folder. This wsp file is needed to deploy in the production environment.

This is the best way to create the wsp file in visual studio 2010.

There are different ways you can deploy the .wsp file

Using browser:

Go to the Central Administration -> Site Actions ->Site Settings -> Galleries –>click on Solutions. After this the below page will open as shown in the figure.

Click on Upload solution and then browse to the wsp file as shown below in 

the figure.

Once you will click Ok then activation window will appear like below figure.


Then you can use the solution.

Using PowerShell:

To add a solution using PowerShell:
Open the SharePoint 2010 Management Shell. You can get to this by going to Start > All Programs > Microsoft SharePoint 2010 Products > SharePoint 2010 Management Shell.

Add-SPSolution {path of wsp file}

To deploy the solution using power shell
Install-SPSolution –Identity {path of wsp file}.wsp –WebApplication http:// -GACDeployment

To update solution
Update-SPSolution –Identity {path of wsp file}.wsp –LiteralPath {local path of wsp file}wsp –GACDeployment

To uninstall solution
Uninstall-SPSolution –Identity {path of wsp file}.wsp –WebApplication http://

Remove solution
Remove-SPSolution –Identity {path of wsp file}.wsp

Using Stsadm:

Open (Dos prompt) then type cd c:"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\bin"

Add the solution using the following command
stsadm -o addsolution -filename {path of wsp file}

Deploy the solution
stsadm -o deploysolution -name {path of wsp file} -url {URL}

Retract solution:
stsadm.exe -o retractsolution -name {path of wsp file}.wsp –URL

Delete Solution
stsadm.exe -o deletesolution -name {path of wsp file}.wsp

To upload Form Template(xsn) in Infopath 2010

Step 1:Upload form template in central admin
General Application Setting  ->Manage Form Templates
Upload  form template



Step 2:Choose the template and upload.
Step 3: Activate to a  site collection ex:http://sp05:2222
Step 4: Go to site


In Advanced Setting :  Allow management of content types?    Yes
Step 5: Click on Add from existing site content type



Step 6Add Content Types Change New Button Order and Default Content Type