Friday, November 7, 2008

SharePoint Master Pages Components Overview

Master Pages

A single master page file can control the look and feel of countless pages within a site/application. It is basically a next generation approach of how to include common content in lieu of frames or server side include files.

Content Pages
Master pages store the layout and design, while content pages define the content. The content page is bound to a master page. Together the two create the presentation layer of content for a site/application.
In SharePoint content pages are called Page Layouts. But they work similar to content pages. The master page file is combined with the page layout to create the presentation layer of content for the SharePoint site. Master Page and Page Layout combine to create the rendered page

The Components of a SharePoint Master Page File

The master page will contain all of the user interface layout code for the site. This includes CSS, JavaScript and HTML.

Examples of what you would put in the master page:
• Header code including company logo and branding images
• Navigation
• Footer code including copyright statements and links
• CSS (cascading style sheet) styles
• Body background colors, images or styles
• Common JavaScript functions

SharePoint 2007 Backup Schedule in Windows 2008

There is no feature available in Microsoft SharePoint 2007 Central adminisration to schedule the back up/restore operations.
The best method is to create a batch file, write the stsadm command for taking and storing backup on some floder of your server or netwrok folder, and finaly put that on windows task scheduler.

Open 'Notepad'

Type Following and save as "SharepointBackschedule.bat"

@echo off
echo =============================
echo Back up sites for the Server farm to C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\SharePoint\

echo =============================

@SET STSADM="c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm"

cd C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\SharePoint\

@echo off

md "%DATE:/=_%"

echo ========================================

echo Directory based on the current date daytime created

echo ========================================

%STSADM% -o backup -directory "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\SharePoint\%DATE:/=_%" -backupmethod full -overwrite

echo completed

Now Click on

Click on Trigger, click on New and select the schedule (Daily/Weekly etc)

Click on the Action and click on new and browse the batch file you have created.

Click Ok

And your scheduler is ready.

Wednesday, November 5, 2008

How to use JS in Sharepoint Masterpages

Save you js file under 12 hive on the following location of the sharepoint server

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\1033

Add the reference In your master page

Determine If Windows SharePoint Services Is in Active Directory Account Creation Mode

To determine if you are in Active Directory account creation mode, type the following command at a command prompt, and then press ENTER:

stsadm.exe -o getproperty -pn createadaccounts
• A response of indicates that Windows SharePoint Services is in Active Directory account creation mode.

• A response of indicates that Windows SharePoint Services is not in Active Directory account creation mode.

SharePoint: Add, deploy, Delete solution

For adding and deploying solution

C:\cd C:\Program Files\Common Files\Microsoft Shared\Web Server Ex

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN>stsa
dm -o addsolution -filename /.wsp

Go back in central admin, deploy the solution

Deleting Solution

from central admin, operations, solutions, Retract the solution
from command line run: stsadm -o deletesolution -name
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN>stsa
dm -o deletesolution -name abc.wsp

Install Feature Command

stsadm -o installfeature -filename SubmissionList\feature.xml -force
stsadm -o activatefeature -filename SubmissionList\feature.xml -url http://localhost

Create User in SQL server 2005


SharePoint : Add group of users to the user collection programmatically

SPWeb web = new SPSite("Site URL").OpenWeb();
SPUserInfo[] userInfo = new SPUserInfo[1];
userInfo[0].Email = "";
userInfo[0].LoginName = @"domain\username";
userInfo[0].Name = "username";
userInfo[0].Notes = "Test";


1. using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Microsoft.SharePoint;
namespace AddUsers
class AddUserClass
static void Main(string[] args)
SPSite siteCollection = new SPSite(”Site URL”);
SPWeb site = siteCollection.OpenWeb();
SPGroup AddUserGroup = site.Groups["Group Name"];
AddUserGroup.AddUser(”domain/alias”, “email address”, “Name”, “Description”);
SPRoleAssignment MyRoleAssign = new SPRoleAssignment(”domain/alias”, “email address”, “Name”, “Description”);
SPRoleDefinition MyRoleDef = newSubWeb.RoleDefinitions["Contribute"];