Friday, May 14, 2010

Lookup field Update with Object Model

To update the look up column using object column. Please follow format at given below:

new SPFieldLookupValue(,"Value to be update");

For Ex.
ListItem["TestColumn"] = new SPFieldLookupValue(11,"61");

Thursday, May 13, 2010

Thursday, May 6, 2010

EventHandlers for Survey List.

Few facts about Survey List Event Handler:
1. If the survey has Page Separator, then when click on next button on first page of survey then ItemAdded event will trigger.
2. After that for every Next Button click on survey will call ItemUpdated. Even at the end a Finish button will also call ItemUpdated event.
3. To achieve the goal with EventHandler on Survey list, you can use following properties,
* SPListItem.HasPublishedVersion
* SPListItem.Level
* SPListItem.MissingRequiredFields

indrajitk@gmail.com
http://blogindrajeet.blogspot.com

Tuesday, May 4, 2010

Attach event handler in SharePoint

SPSecurity.RunWithElevatedPrivileges(delegate()
{

SPSite sps = new SPSite("http://test:1659/");
SPWeb impersonateweb = sps.OpenWeb();
impersonateweb.AllowUnsafeUpdates = true;
SPList _spListAanwezige = impersonateweb.Lists["Survey"];
_spListAanwezige.EventReceivers.Add(SPEventReceiverType.ItemAdded,
"ReplicateData, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1f0faf7eec29149f", "ReplicateData.SurveyEventHandler");
impersonateweb.AllowUnsafeUpdates = false;

});

Can not attach workflow to Survey list.

The status of a workflow appears as "Failed to Start" when you try to start a workflow from a survey response in Windows SharePoint Services 3.0

http://support.microsoft.com/kb/926370