February 21, 2012

Creating web application from existing content database

There are situations where you want to propagate one SharePoint web application
to some other farm/machine. I feel the fastest way is to take content database backup
and restore it in your destination farm. I have done so in last couple of weeks
and I have leaned how to quickly do that.
Here are quick notes from my experience:

Pre-requisites:
I was provided with content database backup and source code. That makes be able
to restore site and generate wsps from source code.
Creating content database from backup:

Go to your database server and do following:
  • Create a blank database that will be used as content database Restore a database
  • using content database back up from source farm.
Creating a web application:
  • Go to sharepoint central administration and create a new web application
  • While creating a new web application, use existing content database in database
    section
  • Sometimes if your database is too large, web application creation takes too long
    and times out. Don't worry at all. web application is still created successfully.
    It happened to me 4 times out of 5.
Validating the web application:
  • Go to sharepoint central administration, click on application management. In "Databases"
    section you will find "Manage content databases"
  • Choose your application and it will show database status and number of site collections.
    If you are not sure how many site collections are there in backup, anything greater
    than 0 is good news.
Configure web application to work properly:
we are almost done now. Do following:
  • Go to sharepoint central administration
  • Click on "Application Management"
  • In "Site Collections" section click on "Change site collection administrators"
  • choose your web application set proper data in site admins.
Additional optional steps:
After performing all the above steps, it is still possible that you are not able
to access your web application.
  • Last thing to do is to install and deploy wsp by using stsadm or your favorite method.
If you have any questions you can reach out our SharePoint Consulting team here.

November 6, 2009

Backup and Restore site in MOSS 2007

It happens to everyone that you need to move the same Microsoft Office SharePoint (MOSS) site to new location. At this time you can use the inbuild commands to backup the site from existing location and restore it to somewhere else.

MOSS has a powerfull command "stsadm" using that you can do it easily.

To use stsadm commands, open the command prompt and navigate to

c:\program files\common files\microsoft shared\web server extensions\12\bin


To Backup Site type the command

stsadm -o backup -url http://servername:portnumber/siteName -filename DestinationFolderPath/Backup Filename(c:\backupfilename)

This command will create a file to destination folder containing backup of the source site.

Once you have the backup file, that can be restored in MOSS by a single commands as below in sequence.
Steps to Restore Site
  • Create a web application and create a site with same site template using Central Administrator which you have backed up.
  • Type the command
stsadm -o restore -url http://servername:portnumber/siteName -filename backupfilepath(c:/backupfilename) -overwrite

This will restore the site to your defined location.

"Make sure you have full rights on the content database to take backup or restore site"

If you have any questions you can reach out our SharePoint Consulting team here.
By: Piyush

November 3, 2009

Display Full Error Description at Runtime in SharePoint 2007

Many times in SharePoint you will stuck at default error page. It says “An unexpected error has occurred” for all kind of errors.


This is very annoying part of SharePoint.

In such case, as a developer or professional, you have two possible ways to find out the exact error.

1) Go to Start > Control Panel > Administrative Tools > Event Viewer and check the internal error message, coz SharePoint itself logs all errors here.

Or

2) If you want to see the error on screen, you can edit configuration settings mentioned below.



• Navigate to web.config file of your SharePoint site.

In Windows Explorer, browse to the following folder

c:\inetpub\wwwroot\wss\virtualdirectories\site directory\site port number\

• Open web.config file in visual studio or notepad.

• Find word ‘CallStack’ and change status false to true

• Again find ‘CustomErrors ’ word and change mode On to Off

• Save and close the web.config file.

Refresh the error page, you will see original error message in screen instead of "An unexpected error has occurred" page.

If you have any questions you can reach out our SharePoint Consulting team here.

By: Piyush