Wednesday, May 5, 2010

SharePoint designer workflow stops periodically.

Symtoms : I had build a simple workflow to send email to a User Group.When I incorporated groups into the workflow-generated emails, it stopped working for almost everyone except me.

Cause:
Send Email action has SharePoint group(s) and/or workflow lookups in the To / Cc line. That SharePoint group has membership visible only to the group member.

Workaround:

Make sure each SharePoint group has at least Read permissions for the site. Additionally, that in the Group Settings area of the Group Page, under Who can view the membership of the group, Everyone is selected.

1. On SharePoint site, click Site Actions -> Site Settings -> Modify All Site Settings.
2. Under Users and Permissions heading, click People and groups.
3. Select appropriate group(s), click Settings -> Group Settings.
4. Under Group Settings area, select Everyone for Who can view the membership of the group, click OK.

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.

Tuesday, May 5, 2009

Limitation of SendEmail Activity of workflow

I don't know if you've run into this, but there seems to be a limitation of 2048 characters in the body of an email sent from the SendEmail activity in a custom workflow for SharePoint. This can make it difficult to include much details in such email that is formatted in HTML and CSS.

Thursday, April 23, 2009

Add People Picker and Date Time Control

Issue: Add WSS DateTimeControl to a custom application page.
Solution: Firstly include below tag for SharePoint assembly in the application page on top.

<%@ Register Tagprefix="wssawc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

DateTimeControl Tag:

<wssawc:DateTimeControl ID="DemoControl1" runat="server" DateOnly="true"></wssawc:DateTimeControl>

People Picker Control Tag:

<wssawc:PeopleEditor ID="OSAccountContact" runat="server" MultiSelect="False" SharePointGroup="OS Global Delivery India" ValidatorEnabled ="true" />

Similarly,you can add other SharePoint Control also in custom application pages.
Note: The PeopleEditor Control will give object reference error when run in aspx pages. Also the DateTimeControl will not show error in aspx page but will not show calendar control for picking the date. You need to add it as a user control or webpart into a sharepoint site to test it and use it.




Error when click on EditForm.aspx in SharePoint custom list


Issue: When clicking on EditForm.aspx of a SharePoint list it redirects to below page with error message "Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries."
Reason: The SQL query passed when opening EditForm.aspx is getting multiple values for some field/fields of the list. This may be possible if you are updating some of the columns in list through workflow. Specially when the columns are lookup column or choice column. When SQL query is run on EditForm.aspx, it will return one value updated through workflow as well as another default value of choice field. Once the list item shows this error it gets corrupted.
Solution: Include all the values updated through workflow in the choice list of the column. In this case, workflow updates the column value which will be one of the choice and hence multiple values will not be fetched through SQL query.
Hope this works for most. As it solved my issue which i was getting since many weeks.