Posts

Showing posts with the label Custom Form Development

Write custom workflow for content approval

In order to write custom workflow for content approval you may need to do a lot depending on your requirements but following are few useful tips that may help you to to it quickly 1. How to approve list item from your code In order to approve list item from your code you need to need to modify list item's moderation status using following line Item.ModerationInformation.Status = SPModerationStatusType.Approved Where Item is your list item 2. In order to start workflow automatically on item publishing event You need to select following option while associating custom workflow with your list "Start this workflow to approve publishing a major version of an item" You may not find this option with your custom work flow if you haven't placed following configuration in your wokflow meta data while defining work flow. < Workflow .... . > .......... < MetaData > < InitiationType > Manual;#OnNewItem;#OnItemUpdate;#OnMajorCheckIn </ InitiationType > ...

General correlation token related issues with CreateTaskWithContentType

You may encounter different issues while working with windows workflow foundation if you have not initialize you correlation token correctly or not configured you activity properly. When you enable tracing or start debugging your workflow you may get following. CorrelationToken Uninitialized for {corelationtokenname} owner activity {Task Name} following configuration needs to be checked in order to rectify above issue. 1. Check "Correlation Token.Owner Activity" is set to current state CreateTaskWithContentType should not run with shared workflow correlation token. You should define separate correlation token for all task activities. The owner of defined correlation token should be your activity. 2. Check all related activities e.g. OnTaskChange etc has same correlation token When you utilize CreateTaskWithContentType activity you may need to place few more activities e.g. OnTaskChange, CompleteTask etc. Activities related to CreateTaskWithContentType activity should have sa...

Sharepoint : How to set content approval status programatically

There are business scenarios when we need to programmatically set content pusblishing status of an Item. Examples would be the custom workflow for publishing or content approval. Following simple line of code can be used to set approval status. item.ModerationInformation.Status = SPModerationStatusType.Approved; item.Update();

How to query data from multiple sharepoint lists

Share point provide two mechanism for querying data from multiple share point lists SPSiteDataQuery FullTextQuery Following link on msdn explain usage for SPSiteDataQuery http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsitedataquery.aspx

Sharepoint Web Control - Validating date time control (SPDateTimeControl with validators)

When working with Sharepoint Controls you may experience different behavior sometime as anticipated with any other controls library. I was thinking of doing some date validation and found some interesting fact with SPDateTime Control. Few were not relevant to me so I didnt looked up them but I need to put required field validator for my mandatory field. I noticed that required field validator included in libaray was not working. After looking at member properties I found that there are properties included in controls for handling this 1. IsRequiredField 2. ErrorMessage I used above fields and it worked for me nicely. The second task was to control invlaid dates entry from user. I thought it would be built in in the control and my guess was right with some exception. Sharepoint was handling this but for some reason it was not controlled at client side. I checked SPDateTimeControl.IsValid at server side and it worked for me. Though it was working on server side I decided to stop false e...

Using sharepoint webcontrols for desinging forms

I prefer using share point web controls for designing share point custom aspx form as they provide extended properties and also provide look n feel similar to out of box look n feel. Following is an useful msdn link for getting help related to controls http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.aspx They are easy to brand with overall theme and master pages. following are list of few important controls Text Box -- SharePoint:InputFormTextBox Drop down -- SharePoint:DVDropDownList People Editor -- SharePoint:PeopleEditor Date Time -- SharePoint:DateTimeControl ( for details on validation) Labels -- Sharepoint:EncodedLiteral Also there are few important webcontrol that can be utilized for creating sections and aligning controls /_controltemplates/InputFormSection.ascx for Defining section /_controltemplates/InputFormControl.ascx for defining control following is a sample ascx for above ---------------------------------------------------------------------- ...