Tuesday, June 8, 2010

Sharepoint designer : Workflow is not start automatically


I’ve been playing with SharePoint Designer Workflows heavily for the past few days. Suddenly I came across the problem of these workflows does not start automatically though I select the option to start the workflow when an item is created or modified in a list or library.
Browse the web and found the reason of installing Windows SharePoint Services 3.0 Service Pack 1 which caused the problem. This behavior occurs because a security fix in Windows SharePoint Services 3.0 SP1 prevents declarative workflows from starting automatically under the system account.

You could fall in to 1 of the 3 scenarios given below while you faced this problem…
1) The Windows SharePoint Services Web application runs under a user's domain account.
2) The user logs in by using this domain account.
3) The site displays the user name as System Account.
Answer / Solution
Set the application pool to use a different user account than System Account.
Step by Step Guide.
1) Open SharePoint Central Administration.
2) Go to Operations Tab.
3) Under Security Configurations click on Service Accounts.
4) Select “Web application pool” option button.
5) In the web service drop down box select “Windows SharePoint Services Web Application”.
6) And in the Application pool drop down, select the application pool you want.
7) Next select the “Configurable” option button and then type the user name and password of a user having rights to assign to an application pool.













8) Go to command prompt and type iisreset /noforce
9) Make sure to test the workflow log-in in to SharePoint other than System Account.

Monday, May 31, 2010

Using SharePoint Calculated Columns to Display Current Month List Items


  1. Created First Day Of Month

    =DATE(YEAR([Created]),MONTH([Created]),1)

  2. Created Last Day Of Month

    =DATE(YEAR([Created]),MONTH([Created])+1,1)-1

I then added the below filters to view:



Richtextbox in sharepoint

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


<SharePointSD:InputFormTextBox runat="server" ID="RichTextBox" ValidationGroup="CreateCase" Rows="8" Columns="40" RichText="true" RichTextMode="FullHtml" AllowHyperlink="true" TextMode="MultiLine" />

Sunday, May 30, 2010

Microsoft.SharePoint.SPListItem.PrepareItemForUpdate + SPWorkflowTask.AlterTask + Task not updated

Hi Guys,

Today I have tried to updated task list item in workflow but everytime i was getting Microsoft.SharePoint.SPListItem.PrepareItemForUpdate error when updated item.

I have used taskcontenttype for aspx task form in my workflow. I have updated task using SPWorkflowTask.AlterTask but not solved my problem.

Solution :

Put FieldRefs in contentType XML.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ContentType ID="0x01080100DB4541EA29924902A6635A9D335C698B"
Name="SOP Issue WF Content Type1"
Group="SOP Issue"
Description="SOP Issue WF Content Type Task"
Version="0"
Hidden="FALSE">
<FieldRefs>

</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<FormUrls xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<New>_layouts/SOPIssueWF/Task1EditForm.aspx</New>
<Display>_layouts/SOPIssueWF/Task1EditForm.aspx</Display>
<Edit>_layouts/SOPIssueWF/Task1EditForm.aspx</Edit>
</FormUrls>
</XmlDocument>
</XmlDocuments>
</ContentType>
</Elements>


Thursday, May 27, 2010

How to get current logged in user in sharepoint object model

using (SPSite site = new SPSite(SPContext.Current.Web.Url.ToString()))
{
using (Microsoft.SharePoint.SPWeb web1 = site.OpenWeb())
{
using (Microsoft.SharePoint.SPWeb web = SPControl.GetContextWeb(Context))

{

SPUser currentuser = web.CurrentUser;

}
}
}