Tuesday, June 30, 2009

Redirect to another aspx using Javascript in SharePoint list

When one has to Redirect from inbuilt SharePoint aspx page to custom aspx page in any sharepoint list, one has to enter Javascript in the design code as below.
< script language="javascript" type="text/javascript" >
//// To include ID od the item as parameter such as in case of EditForm.aspx////
var ID=querySt('ID');
//// Concate the form name with Parameters ////
var url="UsersEditForm.aspx?ID="+ID;
//// Open the form in same window using '_self' attribute in Javascrpt ////
window.open(url,'_self');
//// Function to find the specified parameter value from the current page to pass to next page ///
function querySt(ji)
{
hu = window.location.search.substring(1);
var result="";
gy = hu.split("&");
for (i=0;i {
ft = gy[i].split("=");
if (ft[0] == ji)
{
result = ft[1];
}
}
return result;
}
any sharepoint list, one has to enter Javascript in the design code as below.
< /script >

Wednesday, June 17, 2009

Scheduled Backup of SharePoint Sites

It is not possible to schedule backups from the SharePoint Central Administration Web site. There is no operation that enables you to automate backups by using the Stsadm command-line tool. You can, however, automate the process by creating a batch file and then using Task Scheduler in Microsoft Windows Server 2003 to run the batch file at a specific time.
Steps:
1) To create a batch file, open notepad and type the below text:
-------------------------------------------------------------------------------------------------
@echo off
echo =========================================================
echo Back up sites for the farm to D:\backupSharePoint
echo =========================================================
@SET STSADM="c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm"
cd c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
@echo off
md "%DATE:/=_%"
stsadm -o backup -url "siteurl" -filename "(Full path of shared folder)\%DATE:/=_%.bak"
echo completed
-------------------------------------------------------------------------------------------------
2) In the Save As box, select the folder where you want to keep your batch file.
3) Save the file with ".bat" extension and in the Save as type box, click All files.
4) To create scheduled task for the batch file, open the Control Panel and open Scheduled Tasks.
5) Double click on Add Scheduled Tasks and go through the steps of creating the task. Also add the batch file created for backup.
6) Enter the name for the task, specify how often you wnat task to be repeated and specify the day and time for the task to execute.
7) Enter a name and password for a user, and then click Next. This task will run as if it were started by that user.
The task will be executed and teh .bak file for the backup will be saved in the shared folder.
Important Notes:
1) To perform this procedure, you must be a member of the Administrators, Backup Operators, or Server Operators group, or have been delegated the appropriate authority, on the local computer. As a security best practice, consider using the Run as command to perform this procedure.
2) When creating a scheduled task, you must enter a user name and password, either in the Add Scheduled Task Wizard or in the Run as box on the Task tab of the properties dialog box for the scheduled task. When the scheduled task runs, the program runs as if it were started by the user you specified, with that user's security context.
3) To open Task Scheduler, click Start, click Control Panel, and then double-click Scheduled Tasks. • Confirm that the system date and time on your computer are accurate, as Task Scheduler relies on this information to run scheduled tasks. To verify or change this information, double-click the time indicator on the taskbar.
4) To configure advanced settings for the task, select the Open advanced properties for this task when I click Finish check box in the final page of the wizard. This opens the properties dialog box for the task when you click Finish. You can then change the program being run on the Task tab, fine-tune the schedule on the Schedule tab, customize settings on the Settings tab, or set user and group permissions on the Security tab.