Download presentation
Presentation is loading. Please wait.
Published byAlyson Ball Modified over 9 years ago
1
Minneapolis Office Developer Interest Group (MODIG) April 28, 2009 Custom Workflow Actions in SharePoint Designer Raymond Mitchell Inetium http://www.iwkid.com/
2
The Plan Introduction You are here Feature Presentation Custom Workflow Actions in SharePoint Designer Next Topic Selection Random Stuff
3
User Group Goals Provide a community for SharePoint Developers Share development knowledge Exchange tips/tricks/other/free pizza Add 2,000 List Items…. using a custom action
4
User Group Format Presentations 1-2 per meeting (targeting 1.25 Hours) Hopefully Demo Heavy (Slides are for MBAs) Highlights of Nifty Things See next slide QA/Discussion/Random Things
5
Call for Cool Stuff Created something cool? Send Screenshots or Videos We’ll try to feature some items here
6
Sharepointmn.com/modig/ Our current home Meeting information Usually has the right time Previous presentations Running on SharePoint As required by SharePoint User Group Law
7
Upcoming Next Meeting July 28 (Tuesday 5:30pm) Topic: TBD – Hopefully later today Location: Based on Feedback MNSPUG May 13 (9:00am – Noon) Topic : Business Process / Workflow/ Forms (sharepointmn.com)sharepointmn.com
8
The Plan Overview SharePoint Designer Workflows Actions and Conditions How does it know? Let’s build! Create a custom action Related: web.config modifications Deploy a custom action via Solution Build and deploy a custom condition Would you like to know more? Custom Actions available on CodePlex Resources Questions
9
SharePoint Designer Workflows
10
String together a series of action and condition “sentences” to build a custom workflow A number of Actions and Conditions ship with Windows SharePoint Services Visual Designer:
11
SharePoint Designer Workflows DEMO Out of the box SharePoint Designer Workflow
12
SharePoint Designer Workflows DEMO Behind the scenes – webpartpages.asmx?? ACTIONS file
13
Building Custom Actions
14
Adding Custom Actions High Level Steps: Build an Activity Sign your assembly and deploy to the GAC Create an ACTIONS File Update web.config file to add an authorizedType
15
Build an Activity Activity class (System.Workflow.ComponentModel) DependencyProperties ActivityValidators Add attribute to your class: [ActivityValidator(typeof(ValidatorClassName))] Returns a ValidationErrorCollection to provide fancy error messages in SharePoint Designer
16
Sign your Assembly, Deploy to GAC .snk file .NET Framework 2.0 Configuration: C:\Windows\Assembly gacutil.exe Microsoft.NET Framework SDK
17
Create an ACTIONS file WorkflowInfo Conditions Condition Assembly ClassName FunctionName RuleDesigner Parameters Actions Action Assembly ClassName Category RuleDesigner Parameters
18
Create an ACTIONS file RuleDesigner Sentence Populate %1 with %2 %# maps to FieldBind Can be various types as defined in FieldBind
19
Create an ACTIONS file RuleDesigner Sentence FieldBind DesignerType Field Text Id ValueControl Description BooleanDrop-down list box with the choices true and false populated. ChooseDoclibItemDocument library item selector. ChooseListItemDefault. CreateListItemDefault. DateDate/Time selector. DropdownDrop-down list box control. Static items can be populated by adding Option elements. Email E-mail advanced control. The form displays standard e-mail fields including To, From, CC, Subject and Body. FieldNames Drop-down list box control populated with all field names in the current list or document library. FloatText box. Allows entry of floating point values. HyperlinkURL browser. Select local or remote resources using a standard link builder. IntegerText box. Accepts non-negative integer values. ListNamesDrop-down list box control populated with all lists in the current Web site. Operator Drop-down list box control that includes operators used to evaluate each side of the RuleDesigner sentence. Operators are static and must be added in Options elements. ParameterNames Drop-down list box populated with all local variables that have been entered for use by the workflow. Person Person or Group selector. You can choose only one person or group from either built- in, local users or groups or users and groups from a domain. SinglePerson Person or Group selector. You choose only one person or group from either built-in, local users or groups or users and groups from a domain. StringbuilderInline text box editor. Use to create simple strings. SurveyDefault. TextDefault. TextAreaDefault. UpdateListItemDefault. writablefieldNamesDrop-down list box populated either with a list of fields in the current list or a list of document libraries that are editable. All other fields are hidden.
20
Create an ACTIONS file Parameter Type System.String Microsoft.SharePoint.WorkflowActions.WorkflowContext System.Collections.ArrayList System.Int32 System.Boolean …… Name Maps parameter to a FieldBind Direction (In or Out)
21
Sample.ACTIONS File <Condition AppliesTo="list" Assembly="Assembly.Name, Version=0.0.0.0, Culture=neutral, PublicKeyToken=GUID" ClassName="Fully qualified class name" FunctionName="Boolean method nameimplemented in class" Name="Name to be displayed in workflow editor“ Type="Advanced" UsesCurrentItem="true"> <FieldBind DesignerType="Date" Field="Parameter that FieldBind maps to“ Function="true" Id="Unique positive Integer“ Text="Text to be displayed as a hyperlink" TypeFrom="Parameter that a non-Operator derives its type from“ Value="Reserved for future use">
22
Sample.ACTIONS File <FieldBind DesignerType="CreateListItem" Field="Parameter that FieldBind maps to" Function="true" Id="Unique positive Integer" OperatorTypeFrom="Parameter Operator derives its type from" Text="Text to be displayed as a hyperlink" TypeFrom="Parameter non-Operator derives its type from" Value="Reserved for future use">
23
Add an authorizedType to Web.config Add an authorizedType element to authorizedTypes: Very similar to safe controls, except you can’t automate it with a solution manifest (<safeControl…)
24
Web.config Modifications Should (almost) never, never, never make changes by hand Manual changes are not “farm safe” Manual changes are not “backed up” with SharePoint content We need another challenge
25
Web.config Modifications Enter SPWebConfigModification Name – UNIQUE name of the modification Xpath – path to the node being modified: configuration/System.Workflow.ComponentModel.WorkflowCompiler/authorizedTypes Three Types: Ensure Attribute EnsureChildNode EnsureSection Owner Important if you want to remove later!
26
Web.config Modifications SPWebApplication Add (modification) Remove (modification) SPWebApplication. WebService.ApplyWebConfigModifications() SPWebApplication.Update()
27
SharePoint Designer Workflows DEMO Update a web.config using SPWebConfigModification
28
Deploying Custom Actions
29
High Level Steps: Generate a SharePoint Solution file Web Application Scoped Feature Feature Receiver to add web.config modifications
30
SharePoint Designer Workflows DEMO SharePoint Solution generation with Web App Feature
31
Custom Actions (with context)
32
Adding context to your Actions Parameters that can be added: WorkflowContext __Context Microsoft.SharePoint.WorkflowActions.WorkflowContext __Context.Web __Context.Site These two can only be added if they are going to be used: string ListId int ListItem
33
SharePoint Designer Workflows DEMO Add 2,000 list items to a related list
34
Building Custom Conditions
35
Adding Custom Conditions Class with public static Boolean function Same parameter options for context: WorkflowContext context string listId int listItem
36
SharePoint Designer Workflows DEMO Create a custom condition
37
Custom Actions on CodePlex
38
Useful SharePoint Designer Custom Workflow Activities CodePlex project - http://spdactivities.codeplex.comhttp://spdactivities.codeplex.com Latest release January 2008 Release contains Setup.exe and a SharePoint Solution file Source Code is available to download or browse
39
Useful SharePoint Designer Custom Workflow Activities Email Send Email with HTTP File attachment - Allows sending emails with attachments retrieved using a web request Send Email with HTTP File attachment Send Email with List Item attachments - Allows sending list item attachments as files attached to an email Send Email with List Item attachments Send Email Extended - Enhaced version of the OOTB activity. Allows you to specify the sender. Also does not break links in body. Permissions Grant Permission on Item - Allows granting of specified permission level on a spicified item Grant Permission on Item Delete List Item Permission Assigment - Allows deleting of specified permission level assigment for a given user Delete List Item Permission Assigment Reset List Permissions Inheritance - removes any unique permissions assigned to an item by inheriting list permissions Reset List Permissions Inheritance User Lookup user info - allows to lookup properties in site's user information list for a given login Lookup user info
40
Useful SharePoint Designer Custom Workflow Activities InfoPath Get InfoPath field inner text - allows to query InfoPath form data using XPath Get InfoPath field inner text Get InfoPath field inner xml - allows to query InfoPath form data using XPath Get InfoPath field inner xml Set InfoPath field inner text - allows to change InfoPath form data using XPath Set InfoPath field inner text Set InfoPath field inner xml - allows to change InfoPath form data using XPath Set InfoPath field inner xml Other Start Another Workflow - Starts another workflow associated with a list item Start Another Workflow Copy List Item Extended Activity - Allows copying/moving list items and files cross site. Copy List Item Extended Activity Conditions Is User a member of a SharePoint group - Checks if a given user is part of given sharepoint group Is User a member of a SharePoint group Is Role assigned to User - Checks if a user role is already assigned on the current list item Is Role assigned to User
41
Useful SharePoint Designer Custom Workflow Activities DEMO Installing SPDActivities Creating Workflows using SPDActivities
42
Resources
43
Jeff Zhang’s blog post: “Add Your Own Custom Workflow Activities to SharePoint Designer 2007” http://tinyurl.com/c7s8yjhttp://tinyurl.com/c7s8yj MSDN article: “Building Custom Workflow Conditions for SharePoint Designer” http://tinyurl.com/ca8qd6http://tinyurl.com/ca8qd6 CodePlex project: “Useful SharePoint Designer Custom Workflow Activities” http://spdactivities.codeplex.comhttp://spdactivities.codeplex.com
44
Resources SDK Document: “Importing Custom Actions Into SharePoint Designer” http://tinyurl.com/d9vxsahttp://tinyurl.com/d9vxsa Wesley Bakker’s blog post: “Web.config modifications with a SharePoint feature” http://tinyurl.com/dlzpuw http://tinyurl.com/dlzpuw Ted Pattison.net blog post: “Using a Web Application Feature to Modify web.config” http://tinyurl.com/ct982f http://tinyurl.com/ct982f
45
Next Meeting Planning Possible Topics ?
46
Random Stuff Raymond Mitchell Inetium http://www.iwkid.com Feedback Forms/Giveaway Mingle, Eat, Feedback See you next time!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.