Monthly Archives: December 2015

Associate workflow programmatically

SPWorkflowTemplate baseTemplateWF = web.WorkflowTemplates[“261d83b2-01f5-4dec-9a68-fbd85f5aaf24”]; //In Workflow-> Element.xml -> <Workflow  -> Id SPWorkflowAssociation assocList =SPWorkflowAssociation.CreateListAssociation(baseTemplateWF, “instance name”, taskList, historyList); //taskList: list ok task //historyList: workflow list history assocList.AutoStartCreate = true; // Auto start when new item added list.WorkflowAssociations.Add(assocList);

Posted in SharePoint 2010, SharePoint 2013 | Leave a comment

Prevent deleting workflow task

When we create a workflow, we use workflow task (0x010801) to communicate with the users (make decision, collect data, set variables…).  The instance of the workflow waits this task until passing to complete.  The problem is when a SharePoint user … Continue reading

Posted in SharePoint 2010, SharePoint 2013 | Leave a comment

Create custom action to list instance

SPPList list;//custom list SPUserCustomAction action = list.UserCustomActions.Add(); action.Title = titleAction; action.Sequence = 20; action.Location = “CommandUI.Ribbon”; action.CommandUIExtension=@” <CommandUIExtension> <CommandUIDefinitions> <CommandUIDefinition Location=”Ribbon.Documents.New.Controls._children”> <Button Id=”CustomAction.TestButton” Sequence=”0″ Image32by32=”/_layouts/images/mewa_rightb.gif” Command=”TestCommmand” LabelText=”Button de test” TemplateAlias=”o1″ /> </CommandUIDefinition> </CommandUIDefinitions> <CommandUIHandlers> <CommandUIHandler Command=”TestCommmand” EnabledScript=”javascript:return true;” CommandAction=”javascript:alert(‘Button test’)”/> </CommandUIHandlers> </CommandUIExtension>”; action.Update(); list.Update();

Posted in SharePoint 2010, SharePoint 2013 | Leave a comment

Add ribbon programmatically

I present in this article how you can add a SharePoint ribbon programmatically: Web Part, User Control or an application page. To have finally the end result of FIG 1. We will describe also how we can communicate between the … Continue reading

Posted in SharePoint 2010 | Leave a comment

Create Custom List form

if you have a specific processing in form list (display, edit, new), and you want to create your custom form programmatically. you can follow these steps: Create application page -add application page (customform.aspx) in layouts/Project/ -if you are in the edit mode … Continue reading

Posted in SharePoint 2010, SharePoint 2013 | Leave a comment