Chapter 28 Implementing Microsoft Windows Workflow Services 1017■ If a workflow assembly exists, SharePoint Designer 2007 calls that assembly to instantiate the workflow instance.. ■ Sit
Trang 11014 Part VI Extending Microsoft Office SharePoint Server 2007
third-party products will start to include this technology Windows Workflow
Foundation is embedded in all the Microsoft Office server products—such as
SharePoint Portal Server, Project Server, Navision, and CRM Other Microsoft
products will use Windows Workflow Foundation as well Microsoft BizTalk Server vNext (the one after BizTalk Server 2006) will also include Windows Workflow
Activity Management
SharePoint Server 2007 runs the workflow until it reaches a point at which it cannot ceed until a specific event occurs or the workflow ends This leads to the persistence ofsuch an activity to the database in a single SQL transaction After that, the activity is dis-carded from memory For example, a workflow process might halt until a document isapproved
pro-If a workflow is not currently processing any activities, it can get into an idle state, which
leads to the hydration of a workflow As a result, the workflow is discarded from memory
and persisted to a database If a new event occurs that is targeted toward a hydrated flow, the event handler extracts the workflow ID from the event and passes it into theSharePoint Server 2007 queue manager, which ensures that the correct workflow is
work-started In other words, SharePoint dehydrates the workflow as needed.
The context of workflow events is persisted to tables in the database The two SQL Serverdatabase tables that are most important when it comes to storing information concerningworkflows are Content DB.Workflow and ContentDB.WorkflowAssociation
Important You should not create any application that programmatically
accesses Content DB.Workflow and ContentDB.WorkflowAssociation directly
Microsoft does not support this, and using these tables in this way can cause
severe performance problems You cannot predict what load you will cause on the system when running this type of application Instead, use the SharePoint
Web services API and the SharePoint object model to accomplish tasks related to workflows
Once workflow event information is stored in the database, it sits there waiting for anactive thread of the SharePoint queue manager that is able to pick up the information andprocess it Because of this, it is possible to start a workflow on a given Web front-end andcontinue to work on the workflow on another Web front-end
Trang 2Chapter 28 Implementing Microsoft Windows Workflow Services 1015
If multiple workflow items are queued for processing by the Workflow Foundation
run-time, one item per operating thread is processed until all items are done If the SharePoint
server runs out of bandwidth, the SharePoint Timer Service (also known as the Windows
SharePoint Services Timer, or SPTimer) is used to queue items The SharePoint Timer
Ser-vice is a Windows serSer-vice that handles scheduled jobs For example, not only is the
SharePoint Timer Services responsible for queueing workflow items, it is also responsible
for handling workflow Delay activities Delay activities are parts of a workflow that allow
you to build delays in a workflow based on a time-out interval
Workflow items are always processed by hydrated workflows The decision to hydrate or
dehydrate a workflow is made by SharePoint Currently, it is not possible to influence this
decision process and influence settings regarding queueing, load balancing, and
time-based execution
Storing Source Files in Document Libraries
Workflows designed with SharePoint Designer 2007 do not contain custom code and are
not compiled and deployed as assemblies are Rather, they are stored in the form of
source files within Windows SharePoint Services and compiled into memory only when
needed For each SharePoint site, workflows of this type are stored in a separate
docu-ment library This docudocu-ment library contains a folder for each workflow designed in
SharePoint Designer 2007 The folder contains all the source files necessary for the
work-flow, including the following ones:
■ The workflow markup file, which contains markup that describes the activities
included in the workflow Workflow markup files have the xoml file extension
■ The workflow rules file, which contains the business logic of the workflow in the
form of declarative rules (instead of code) Workflow rules files have the
.xoml.rules file extension
■ The workflow configuration file, which contains general workflow configuration
information Such files have the xoml.wfconfig.xml file extension
■ ASP.NET Web Forms for any custom workflow forms necessary Web Forms have
the aspx file extension
As you can see in Figure 28-1, SharePoint Designer 2007 shows you all source files that
are part of a workflow in the Folder List task pane
Trang 31016 Part VI Extending Microsoft Office SharePoint Server 2007
Figure 28-1 Source files of a workflow
Workflow Markup Language
Workflows are expressed in xoml files containing workflow markup language The xomlfile extension, shown in Figure 28-1, stands for eXtensible Object Markup Language(XOML) and is a serialization format for the Windows Workflow Foundation workflowobjects The schema for xoml files is identical to the schema that is used for xaml (eXten-sible Application Markup Language) files The only difference lies in the names of the fileextensions
Note The xaml (pronounced “zammel”) extension is the user interface markup language for Windows Presentation Foundation
In principle, xoml files can be created using any text or XML editor you choose, as long
as such files adhere to the XOML schema Nevertheless, it is advisable to use either Point Designer 2007 or Visual Studio 2005 Designer because those products have built-
Share-in support for creatShare-ing workflows
Compiling Source Files
SharePoint Designer 2007 contains a just-in-time compiler that is able to compile theworkflow source files into a workflow the first time that workflow is started SharePointDesigner 2007 keeps the compiled workflow in memory to speed up future executionperformance Each time a workflow is started on a list or library item, SharePointDesigner 2007 needs to determine whether the workflow was deployed as an assembly
or in the form of a collection of source files The decision process contains the followingsteps:
Trang 4Chapter 28 Implementing Microsoft Windows Workflow Services 1017
■ If a workflow assembly exists, SharePoint Designer 2007 calls that assembly to
instantiate the workflow instance
■ If the workflow was deployed as a collection of source files, SharePoint Designer
2007 has to determine whether it already has a workflow loaded in memory that
was compiled based on those source files
❑ If the workflow was previously compiled, SharePoint Designer 2007 calls the
in-memory compiled workflow to instantiate the workflow instance
❑ If the workflow was not compiled earlier, SharePoint Designer 2007 uses its
just-in-time compiler to compile source files into an in-memory workflow,
which then will be called to instantiate the workflow instance
How to Implement a Workflow
What choices do you have when it comes to implementing workflows? In
Share-Point Portal Server 2003, sophisticated workflows were often implemented using
third-party products With the advent of strong support for workflow technology in
SharePoint Server 2007, those third-party vendors will probably become less
important in the near future If you want to, you can also create your own workflows
using the SharePoint event model
For Windows and ASP.NET applications, developers can use the User Interface
Pro-cess Application Block (UIPAB), which can be downloaded for free from http://
www.microsoft.com/downloads/details.aspx?familyid=98C6CC9D-88E1-4490-8BD6-78092A0F084E&displaylang=en on the Microsoft Web site as a component that can
be used in developing workflows
Microsoft Exchange Server 2000 and 2003 and SharePoint Portal Server 2001
included a workflow engine that could be used to create workflows of medium
complexity (This workflow engine was a part of SharePoint Portal Server 2001 and
was not supported officially.)
BizTalk Server 2006 includes Human Workflow Services (HWS), a technology
intended to aid in creating human-oriented workflows, although Human Workflow
Services is now considered to be deprecated technology BizTalk Server includes a
Windows SharePoint Services adapter that is able to communicate with SharePoint
lists and libraries and can be used to build workflows, although this requires a
con-siderable amount of work
Currently, if you are building workflows using Microsoft technology, not just for
SharePoint technology, the most appealing options are Windows Workflow
Foun-dation and BizTalk Server 2006 Use Windows Workflow FounFoun-dation when you are
Trang 51018 Part VI Extending Microsoft Office SharePoint Server 2007
creating workflows within an application (human-oriented workflows), and useBizTalk Server 2006 for creating workflows across applications (application-ori-ented workflows) Both products are suitable choices because they speed up thedevelopment time for creating workflows considerably and have a bright future
Windows Workflow Authoring
Three important groups of users can be distinguished when it comes to creating flows: knowledge workers, site administrators and Web designers, and developers Thefollowing list describes the most likely division of responsibilities of these groups:
work-■ Knowledge workers This group of users consists of people who will create ad hocworkflow solutions based on the predefined workflows already available in Share-Point Designer 2007 The complexity of these workflows will be low
■ Site administrators and Web designers This group will use SharePoint Designer
2007 to create custom workflows for a specific list or library The complexity ofsuch workflows will be average
■ Developers Developers will primarily use Visual Studio 2005 Designer to gram their own workflows, custom code, and activities Developers can use VisualStudio 2005 Designer to create highly complex workflows
pro-Workflows authored in SharePoint Designer 2007 differ from those created using theVisual Studio 2005 Designer for Windows Workflow Foundation in several importantways:
■ In SharePoint Designer 2007, a workflow cannot be deployed to multiple lists Suchworkflows are valid only for the list for which they were created
■ In SharePoint Designer 2007, you are authoring the workflow directly against a listand the workflow is associated with the list or library at design time After the asso-ciation is made, workflows are allowed to be run on items within the list or library.Workflows created using Visual Studio 2005 Designer have to be associated explic-itly with a list or library through configuration The advantage of the latterapproach is that a workflow can be associated with multiple lists and libraries
■ You cannot modify workflows authored in SharePoint Designer 2007 Workflowmodifications are explained in the “What Is Different” section later in this chapter
■ You cannot associate a workflow to a content type using SharePoint Designer 2007.Associating a workflow to a content type means that each list to which a content
Trang 6Chapter 28 Implementing Microsoft Windows Workflow Services 1019
type is added inherits the workflows associated to the content type at that time
Workflow associations update according to the rules of content type push down In
other words, if the administrator makes a change to a content type, he can choose
to push down this change
Comparing SharePoint Designer 2007 and Visual
Studio 2005 Designer
SharePoint Designer 2007 workflows are also referred to as no-code workflows All
activi-ties used within a SharePoint Designer 2007 workflow are well-known safely registered
libraries that already have been deployed on the server
Note A safely registered library is a NET assembly that is registered as an entry
on the SharePoint virtual server Web.config <SafeControls> list Detailed
infor-mation about this topic can be found in Chapter 31, “Administrating Code Access
Security.”
SharePoint Designer 2007 does not allow you to create your own activities, although it is
able to generate raw XOML data, which is stored on the SharePoint server During
work-flow execution time, the XOML data is interpreted by the runtime engine, which ensures
that all activities used within a workflow are marked as safe It is possible to use custom
activities that are created using Visual Studio 2005, as opposed to using one of the
pre-defined activities Such activities have to be marked on the SharePoint virtual server as
being safe
What Is the Same
Visual Studio 2005 Designer and SharePoint Designer 2007 both offer the following
capabilities:
■ You can create workflows for SharePoint Designer 2007
■ A workflow markup file is generated If you are using SharePoint Designer, a
work-flow markup file is generated after selecting and configuring the conditions and
actions for a workflow The workflow markup file is generated as soon as you click
the Finish button of the Workflow Designer Wizard Visual Studio 2005 Designer
has a graphical tool that helps to create the workflow markup file Visual Studio
2005 Designer lets you create a graphical model representing the workflow, and the
workflow markup file is generated based on this representation
Trang 71020 Part VI Extending Microsoft Office SharePoint Server 2007
■ Workflows can be started based on certain events, such as the creation of a newdocument, and they can also be started manually You can define multiple initiationforms that gather information from users Initiation forms are displayed when usersmanually start a workflow on a SharePoint item
■ You can use custom forms for users to interact with SharePoint tasks
The following three types of forms are used in SharePoint Designer 2007 workflows:
■ Association and initiation forms are displayed to users and need to be filled out
before the workflow itself is started
■ Modification forms present options to users that change the course of the workflow
itself as it is running on an item For example, a user might redirect the task of adocument review to another person
■ Task forms are custom forms that help to create tasks that are the result of the
work-flow process, and they can be used to specify detailed information about a task Forexample, if a user finishes a document review, this might lead to the creation of anew task As a result, the original author needs to review the document Thereviewer might use the task form to write some additional comments directed tothe author
Note Windows SharePoint Services 3.0 workflows are forms agnostic This
means that you can use any forms technology you want, as long as the forms
created are capable of invoking the Windows SharePoint Services object model, generating the data necessary to send to the Windows SharePoint Services object model, and receiving and parsing the required data from the Windows SharePoint Services object model Currently, you can build workflow forms using ASP.NET or InfoPath
What Is Different
The ways in which workflows authored in SharePoint Designer 2007 differ from thosecreated using the Visual Studio 2005 Designer for Windows Workflow Foundation isdescribed in the “Windows Workflow Authoring” section earlier in this chapter Table28-1 provides an overview of the differences between Visual Studio 2005 Designer forWindows Workflow Foundation and SharePoint Designer 2007 when it comes to creat-ing workflows
Table 28-1 Workflow Development Tools Differences
Visual Studio 2005 Designer for Windows
Workflow Foundation Office SharePoint Designer 2007
Code-behind files enable developers to write
custom C# or Visual Basic code to express
business logic
No code-behind files; workflow rules files declaratively encapsulate business logic instead
Trang 8Chapter 28 Implementing Microsoft Windows Workflow Services 1021
Considerations
If you need to decide whether to create a workflow using SharePoint Designer or Visual
Studio 2005 Designer, keep the following points in mind If you are using Visual Studio
2005 Designer, you can create workflow templates and custom workflow activities, and
you can also include code in your workflow and design forms Also, when you use Visual
Studio 2005 Designer, you are not programming a workflow against a specific SharePoint
site At a later time, you will be able to associate the newly created workflow with multiple
SharePoint sites
Workflow is authored as a template, which
can be associated with multiple sites and lists
Workflow is authored against a specific list and is data-bound to it at design time
Workflow markup files, or markup and
code-behind files, are compiled into a
workflow assembly
Workflow markup, workflow rules, andsupporting files are not compiled into an assembly and are stored directly in a specific document library on a SharePoint site
Workflow template must be associated with
each list on which it is to be available
Association happens when the workflow is authored against the specific list; no later association is necessary or possible
You can use any forms technology For
Microsoft technology, this currently comes
down to the ability to include ASP.NET and
InfoPath forms in SharePoint workflows
ASP.NET forms are automatically generated, and you can then customize them
You can include workflow modifications Workflow modifications are not available
Workflow modifications are options that you present to your users to change the course of the workflow as it is running on an item For example, you can allow a user to assign her tasks to another user
You can author custom activities for inclusion
in workflows
You must use activities that are alreadyprovided on the SharePoint server
Workflow assembly and workflow definition
are packaged as a SharePoint Feature and
deployed to a SharePoint site
Deployment to a specific list or libraryhappens automatically
Microsoft Visual Studio debugging is available No step-by-step debugging is available
You can author both sequential and state
workflows
You can author only sequential workflows
Table 28-1 Workflow Development Tools Differences
Visual Studio 2005 Designer for Windows
Workflow Foundation Office SharePoint Designer 2007
Trang 91022 Part VI Extending Microsoft Office SharePoint Server 2007
If you use SharePoint Designer 2007 to create a workflow, you are always designing aworkflow for a specific SharePoint site SharePoint Designer 2007 enables you to createdeclarative, rule-based workflows, and it lets you use pre-existing activities that arealready deployed on the SharePoint server in your workflows You cannot create yourown activities or write code-behind pages However, you can create new activities inVisual Studio 2005 Designer and use these to extend the set of activities located on theSharePoint server After doing so, you can use those extended activities in SharePointDesigner 2007 workflows
Code-Behind and Code-Beside Files
In the discussion about creating workflow applications so far, code-behind fileshave been mentioned now and then As an administrator, you probably won’t have
to deal with this concept on a daily basis, but it might be useful to take a moment
to elaborate on this topic
Code-behind files are a concept best known from the ASP.NET world, where every
.aspx page is compiled on request and ultimately inherits from a base class called
Page Code-behind files help to separate user interface code from page controller
logic by forming an intermediate class that sits between the aspx page and the
ulti-mate Page base class Code-behind files are usually compiled into assemblies and
placed in the /bin directory of an ASP.NET application Because the NET commonlanguage runtime (CLR) automatically adds references to assemblies placed in the/bin directory, the aspx page will have no trouble finding the code-behind class
With the advent of ASP.NET 2.0, the behind model has changed to a
code-beside model Using the new concept of partial classes that allow one class to be
defined in multiple source files, the aspx file does not have to inherit from the behind file anymore Instead, the aspx file and the code-behind file are both partialclasses that form a single class after compilation The result of this is cleaner code Whenever this chapter refers to code-behind files, we are referring to partial classesthat will be merged with other source files during compilation
Trang 10code-Chapter 28 Implementing Microsoft Windows Workflow Services 1023
Building a Workflow by Using SharePoint
Designer 2007
A custom workflow that is created using SharePoint Designer 2007 can be started in
var-ious ways: automatically after a file is created, automatically after a file is changed, or
man-ually Within workflows, you can use actions that are available out of the box, such as
assigning a task to someone or sending an e-mail
Note Take some time to think about how the workflow should look before you
grab SharePoint Designer 2007 Make sure you have, at the least, a clear picture
of the workflow in your mind before you start creating one Or better yet, create
some kind of diagram to represent the workflow Microsoft Office Visio is a
suit-able tool to create workflow diagrams
The whole procedure of building a workflow with SharePoint Designer 2007 can be
divided into four steps:
1 Create a workflow.
2 Customize the workflow initiation settings.
3 Configure the predefined conditions and activities.
4 Generate the workflow definition template and deployment.
In addition, the workflow designer should understand how SharePoint Designer 2007
controls custom activities but allows the extension of built-in workflows Each of these
topics is discussed in this section
Creating a Workflow
To create a new workflow with SharePoint Designer 2007, complete the following steps:
1 Open the SharePoint site where you want to create a workflow using SharePoint
Designer 2007
2 Open the Workflow Designer Wizard by using one of the flowing methods:
a On the File menu, point to New and then select Workflow.
b On the File menu, select New
This will start the New dialog box, shown in Figure 28-2 Click on the Point Content tab, and choose Workflow Click Blank Workflow to create anew workflow
Trang 11Share-1024 Part VI Extending Microsoft Office SharePoint Server 2007
Figure 28-2 SharePoint Content tab in the New dialog box
3 On the Workflow Designer page shown in Figure 28-3, give the workflow a
descrip-tive name and attach the workflow to a list that is available on your SharePoint site
A drop-down list shows all lists located on your SharePoint site
Figure 28-3 Defining your new workflow
Trang 12Chapter 28 Implementing Microsoft Windows Workflow Services 1025
You can also select one or more of the following workflow start options for items in
the list you have chosen:
a Allow This Workflow To Be Manually Started From An Item
b Automatically Start This Workflow When A New Item Is Created
c Automatically Start This Workflow Whenever An Item Is Changed
4 Click Next This takes you to the configuration of the workflow steps, including the
conditions and activities
Customizing the Workflow Initiation Settings
A workflow uses initiation forms that are displayed to users as soon as they start a
work-flow that is associated with a given SharePoint item You can use initiation forms to let
users override or append the association parameters set by administrators, or specify
additional parameters or information about the workflow as it applies to the given
Share-Point item Not all workflows require the use of initiation forms You can create an
initia-tion stage for your workflow in SharePoint Designer 2007 If you do, SharePoint Designer
2007 automatically generates an initiation form, using ASP.NET, according to your
initia-tion specificainitia-tions
To create an initiation form according to your initiation specifications, complete the
fol-lowing steps:
1 Click the Initiation button at the bottom of the Workflow Designer Wizard This
opens the Workflow Parameters dialog box (See Figure 28-4.)
Figure 28-4 Workflow Parameters dialog box
2 Click Add to add workflow parameters This opens the Add Field dialog box shown
in Figure 28-5
Trang 131026 Part VI Extending Microsoft Office SharePoint Server 2007
Figure 28-5 Add Field dialog box
3 The Add Field dialog box gives you the chance to add a field to specify a workflow
parameter and choose an information type for that field There is a range of typesyou can choose from Depending on which type you choose, other contextual val-ues will need to be defined For example, if you create a new field called DateFin-ished and select the information type Date And Time, and click Next, a newwindow appears that shows you a range of options specifically concerned with dateand time, as shown in Figure 28-6
Figure 28-6 Defining date and time information type for a field
SharePoint Designer 2007 generates all ASP.NET forms that are required for workflow tiation These aspx files are stored on the SharePoint site, together with the workflowsource files They can be opened and customized in the same way as you would for anyother ASPX Web Form
ini-Configuring the Predefined Conditions and Activities
The next step of the workflow build process is to define the workflow steps There is nopractical limit to the number of workflow steps that can be added to a workflow; you canadd as many as you want You can add a workflow step by clicking on the Add WorkflowStep link at the right of the wizard page under the heading Workflow Steps (see also Fig-ure 28-15 later in this chapter) This Workflow Designer Wizard page lets you select con-ditions and activities
Trang 14Chapter 28 Implementing Microsoft Windows Workflow Services 1027
Note Be sure to give the workflow step a descriptive name This makes it easier
to adjust the workflow once it is created
Conditions
Conditions are configurable conditional clauses that direct the flow of the workflow
Con-ditions are represented by a sentence that contains variables that can be configured by
the workflow designer using drop-down menus and dialog boxes You can select
condi-tions from a predetermined list and configure those condicondi-tions using the SharePoint
Designer 2007 interface
In SharePoint Designer 2007, you have nine standard conditions to choose from The
fol-lowing list provides an overview of all available conditions:
■ Custom Condition: field equals value The field and value variables are variables that
can be configured by you For example, if you previously selected that the workflow
applies to a document library, clicking field results in the display of a drop-down list
containing all column names of that document library Values in custom conditions
are context-dependent For example, you can choose a document library column
that has the drop-down list data type Once you click the value variable of a custom
condition, a drop-down list is displayed that contains the values of the document
library drop-down list column
■ Title Field Contains Keywords: title field contains keywords The only part of a Title
Field Contains Keywords condition that you can configure is the keywords variable.
This variable is a text box that lets you type the keywords that you want to use If
you are unsure which keywords you are looking for, you can click the Display
Data-Binding button next to the Keywords item to display the Define Workflow Lookup
dialog box shown in Figure 28-7 This dialog box gives you the chance to select a list
or library from a SharePoint site and look up which values it contains
Figure 28-7 Define Workflow Lookup dialog box
Trang 151028 Part VI Extending Microsoft Office SharePoint Server 2007
■ Modified In A Specific Date Span: modified between date and date This condition lets you define two date variables If you click one of the date variables, you can use
the Date Value dialog box to choose a value This dialog box is shown in Figure 28-8
Figure 28-8 Date Value dialog box
■ Modified By A Specific Person: modified by specific person The specific person
vari-able lets you configure a specific person via the Select Users dialog box shown inFigure 28-9
Figure 28-9 Select Users dialog box
■ Created In A Specific Date Span: created between date and date This condition tains two date variables You can specify values for the date variables via the Date
con-Value dialog box (shown earlier in Figure 28-8)
■ Created By A Specific Person: created by a specific person The value for the specific
person variable can be configured via the Select Users dialog box (shown in Figure
28-9)
■ The File Type Is A Specific Type: the file type is specific type You can configure the
specific type variable by typing the file type extension you expect in the text box that
appears
■ The File Size In A Specific Range Kilobytes: the file size is between size and size bytes The sizes variables are configurable via text boxes that will only let you type
kilo-numerical values
Trang 16Chapter 28 Implementing Microsoft Windows Workflow Services 1029
■ Advanced Condition: value equals value You can configure the values variables via the
Display Data-Binding button, which is located next to the Keywords item This opens
a Define Workflow Lookup dialog box, which was shown earlier in Figure 28-7
Activities
SharePoint Designer 2007 uses a wizard-driven interface that enables users to build
sequential workflows that consist of predefined activities Users can select activities from
a predetermined list and configure those activities using the SharePoint Designer 2007
interface These activities are essentially the same activities that are present in the Visual
Studio 2005 Designer for Windows Workflow Foundation There is a small difference,
however, because SharePoint Designer 2007 hosts a user interface that is considerably
more user friendly In SharePoint Designer 2007, each activity appears in the form of an
action, represented by a sentence that contains variables that the user can configure
using drop-down menus and look-up dialog boxes In Visual Studio 2005 Designer, you
have to manipulate activities programmatically
Core Actions
Out of the box, SharePoint Designer 2007 supports 17 different actions Those actions
can be divided into core actions, task actions, and list actions The following list provides
an overview of the core actions:
■ Send An Email: send this message Clicking the this message variable displays the
Define E-mail Message dialog box shown in Figure 28-10 This dialog box lets you
compose a message and makes extensive use of lookup variables to facilitate this
process
Figure 28-10 Define E-mail Message dialog box
Trang 171030 Part VI Extending Microsoft Office SharePoint Server 2007
■ Set Field In Current Item: set field to value Clicking the field variable results in the
display of a drop-down list containing all the columns that are available for the list
or library The value variable can be configured by typing a value into a text box or
by clicking the Display Data Binding button to open the Define Workflow Lookupdialog box (shown earlier in Figure 28-7)
■ Wait For Field Change In Current Item: wait for field to equal value Clicking the field
variable displays a drop-down list containing all column names of the list or library
that you have previously selected The value variable is context-dependent If the
field variable you choose is a column that has the drop-down list data type, the
val-ues of this column are displayed as a drop-down list once you click the value variable.
■ Set Workflow Variable: set workflow variable to value Clicking the workflow variable
displays a drop-down list containing all variables that are custom made for this ticular workflow If there are no workflow variables made yet, you get the option tocreate a new variable You can also create a workflow variable by clicking the Vari-ables button at the bottom of the Workflow Designer Wizard This opens the Work-flow Local Variables dialog box shown in Figure 28-11
par-Figure 28-11 Workflow Local Variables dialog box
■ Do Calculation: calculate value plus value, store in variable Clicking the variable
item displays a drop-down list containing all the workflow variables that you havemade for this particular workflow If there are no workflow variables present, youcan create a new one by clicking the Variables button at the bottom of the WorkflowDesigner Wizard This opens the Workflow Local Variables dialog box shown inFigure 28-11
■ Stop Workflow: stop the workflow and log this message The this message variable
can be configured to define a helpful message explaining why the workflow hasstopped This message will be logged in the history list
■ Log To History List: log this message to the workflow history list You can define a message using the this message variable, which is logged in the workflow history list
on the SharePoint site
Trang 18Chapter 28 Implementing Microsoft Windows Workflow Services 1031
■ Set Moderation Status: set moderation status to this status with comments Clicking
the this status variable displays a drop-down list containing the following status
val-ues: approved, rejected, and pending Clicking the comments variable displays a text
box that enables you to define additional comments
Task Actions
The following list provides an overview of the three task actions that are available in
SharePoint Designer 2007:
■ Collect Data From A User: collect data from this user, store task ID in 0 The data and
this user variables can be configured by clicking them If you click the data variable,
the Custom Task Wizard dialog box opens, which offers you the chance to create a
custom task for your workflow SharePoint Designer 2007 automatically generates
an ASP.NET form for such a task, according to the specifications defined in the
wiz-ard Creating a task consists of giving the task a custom name, giving it a
descrip-tion, and defining fields (or questions) for the task Please refer to the “Creating a
Real World Workflow Example” section that demonstrates how to implement an
example workflow Each field is based on an information type (or data type) For
example, you can create a drop-down list or a field that contains a single line of text
This option was shown earlier in Figure 28-5 Tasks are used to collect information
from workflow users The information will be stored in the Tasks list in the
Share-Point site that contains the workflow You can use custom task information later in
the workflow by retrieving it via the Define Workflow Lookup dialog box
If you click the this user variable, you can select one person or more in the Select
Users dialog box (See Figure 28-9.) Each task has a unique task ID By default, this
is 0 Task IDs can be changed by assigning the value of a workflow variable to it You
can create a workflow variable by clicking the Variables button at the bottom of the
Workflow Designer Wizard This opens the Workflow Local Variables dialog box
shown in Figure 28-11
■ Assign A Todo Item: assign a todo item to these users Clicking on the a todo item
vari-able opens the Custom Task Wizard dialog box This dialog box lets you define a
todo item that will be added to the task list for each specified user With the these
users variable, you can select one or more users in the Select Users dialog box
(shown earlier in Figure 28-9)
■ Assign A Group Survey: assign a custom survey to these users Clicking the a custom
survey variable opens the Custom Task Wizard dialog box This dialog box lets you
define a survey form for a group of users With the these users variable, you can
select one or more users in the Select Users dialog box (shown in Figure 28-9)
Trang 191032 Part VI Extending Microsoft Office SharePoint Server 2007
The following list provides an overview of the six list actions that are available in Point Designer 2007:
Share-■ Update List Item: update item in this list Clicking the this list variable opens the
Update List Item dialog box shown in Figure 28-12
Figure 28-12 Update List Item dialog box
■ Create List Item: create item in this list Clicking the this list variable opens the
Cre-ate New List Item dialog box shown in Figure 28-13 This dialog box gives you thechance to choose which list you want to create a new item in
Figure 28-13 Create New List Item dialog box
Trang 20Chapter 28 Implementing Microsoft Windows Workflow Services 1033
■ Copy List Item: copy item in this list to this list Clicking the first this list variable
opens the Choose List Item dialog box shown in Figure 28-14; clicking the second
this list variable shows a drop-down list containing all available lists.
■ Check Out Item: check out item in this list Clicking the this list variable opens the
Choose List Item dialog box (shown in Figure 28-14)
■ Check In Item: check in item in this list Clicking the this list variable opens the
Choose List Item dialog box (shown in Figure 28-14)
■ Delete Item: delete item in this list Clicking the this list variable opens the Choose
List Item dialog box (shown in Figure 28-14)
Figure 28-14 Choose List Item dialog box
While you are designing a workflow, you can click the Check Workflow button at the
bot-tom of the Workflow Designer page (shown in Figure 28-15) at any time to check
whether your workflow is correct If the workflow is correct, a window appears that tells
you the workflow does not contain any errors If the workflow is not correct, asterisk
signs (*) appear to indicate the problem areas of your workflow
Trang 211034 Part VI Extending Microsoft Office SharePoint Server 2007
Figure 28-15 Workflow Designer page for verifying workflow details
Adding Conditional Branches to the Workflow
For each workflow step, you can add one or more conditional branches A conditionalbranch can contain one or more conditions and one or more actions You can add a con-ditional branch by clicking the link called Add ‘Else If’ Conditional Branch in the Work-flow Designer page (shown in Figure 28-15) This adds another set of conditions andactions to the workflow
Each conditional branch, consisting of a set of conditions and actions, can be moved upand down in the tree of conditional branches For each conditional branch, you can alsomove the conditions and actions up and down You can even specify whether you wantyour actions to be executed parallel or sequentially If you choose to run actions in paral-lel, all actions that are a part of a particular conditional branch are run at once, simulta-neously If you choose to run actions in sequence, the first action in a particularconditional branch is run, followed by the next one and so on, until the last action of thatbranch has finished executing
Trang 22Chapter 28 Implementing Microsoft Windows Workflow Services 1035
Generating the Workflow Definition Template and Deploying
the Workflow
The next step in the workflow creation process is the generation of a workflow definition
template and the deployment of the workflow This is not hard to do because the
work-flow definition template is generated automatically by SharePoint Designer 2007, which
is also responsible for handling the deployment of the workflow to the specified list
Clicking the Finish button in the Workflow Designer Wizard displays a window that
shows an overview of the status of the workflow generation and its deployment
Because you are designing a workflow against a specific list, and the deployment of
work-flows created in SharePoint Designer is taken care of for you, deployment is a much
sim-pler process than the deployment of workflows created in the Visual Studio 2005
Designer for Windows Workflow Foundation
Deleting a Workflow and Managing Source Files
Deleting a workflow from a list or library that was designed in SharePoint Designer
2007 does not delete the actual source files that are used to compile that workflow
Instead, the workflow is no longer associated with the list or library, although the
source files remain stored in the workflow document library on the site
You might find it useful to keep the source files around if you want to reuse items
within the workflow in another workflow by copying them into the other workflow
folder Other than that, you can’t do much with the source files of a deleted
flow If you are not planning to reuse workflow items, you should remove the
work-flow from the workwork-flow document library
Real World Creating a Workflow Example
You have already learned how to employ SharePoint technology to create
work-flows To illustrate the concepts discussed so far, you will now learn how to create
a simple real-world workflow example
Imagine, if you will, a company that gets regular requests from potential customers
that are interested in purchasing a product The potential customers want to learn
more about the price of this product and want to receive extensive product details
The way our imaginary company deals with such requests is that it assigns an
account manager that handles the request by writing a customized Request For
Information (RFI) document After writing this document, it needs to be reviewed
by a colleague before sending it to the customer
Trang 231036 Part VI Extending Microsoft Office SharePoint Server 2007
In this section, you will learn how to create a workflow that facilitates this process
To keep things simple, you will create a specific document library that contains uments that are relevant to our account managers The SharePoint workflowsprings into life as soon as a document is entered into this document library thatcontains the word Request in its title As soon as that happens, a new task will becreated indicating that such a document needs to be reviewed
doc-In order to support this workflow, you first need to go to a specific SharePoint siteand create a new document library called RFI Documents This document librarywill contain the documents created by account managers
Once you have created this document library, start SharePoint Designer and openthe SharePoint site that contains the RFI Documents document library In the nextprocedure, you will start the creation of a new workflow
1 Click File, select New, and choose workflow.
2 This opens the first step of the Workflow Designer wizard Choose the
follow-ing value for the workflow name: RFIWorkflow
3 Select the RFI Document document library from the drop-down list.
4 Check the “Automatically start this workflow when a new item is created”
check box
5 Click Next.
Since you want to create a workflow that scans the title of documents and looks forthe word Request, you are going to add a workflow condition If this condition istrue the workflow needs to create a new task indicating that a new RFI document
is added that needs reviewing You will add a workflow action that is responsible forthis The next procedure explains how to create a workflow condition and action tosupport our basic workflow process This procedure continues where you left off, inthe middle of the Workflow Designer wizard
1 Click the Conditions button.
2 Select the following condition: Title field contains keywords.
3 Click keywords.
4 In the textbox that appears, type the following value: Request This results in
the addition of a condition to the workflow that states that some kind ofaction should happen if the title contains the keyword Request
5 Click the Actions button.
Trang 24Chapter 28 Implementing Microsoft Windows Workflow Services 1037
6 Select the following action: Create List Item.
7 Select the “This list” variable This opens the Create New List Item dialog box.
8 In the Create New List Item dialog box, select Tasks from the List drop-down
list
9 Click the Add button to add a field to the item that will be created in the Tasks
list Call this field Title and assign the following value to this field: Request
Click OK
At this point, you have created a workflow Click the Check Workflow button in the
Workflow Designer wizard to validate the workflow and make sure that it does not
contain any errors Then, click Finish After that, the SharePoint user interface
dis-plays a dialog box that indicates the workflow is being processed When that is
done, you can start testing the workflow by adding a new document to the RFI
doc-uments document library with the word Request in its title
Using Custom Activities in SharePoint Designer 2007
Workflow designers cannot use SharePoint Designer 2007 to create custom activities that
can be used in custom workflows Instead, SharePoint Designer 2007 limits the use of
activities and conditions to the set that has been included in the safe list that is included
in the Web.config file of a SharePoint virtual server Because of this, the workflow
designer can rest assured that all activities and conditions have been pre-approved by a
server administrator and thus should be safe to use Conversely, server administrators
can rest assured that workflow designers will not be able to create and deploy activities
and conditions to the server without their approval
Note The safe list provides a safety net: workflow designers and developers
cannot deploy custom activities and conditions without the explicit consent and
approval of a server administrator
A condition consists of a custom NET assembly containing a static method that
evalu-ates some condition and returns a Boolean value when it is called Developers can create
custom activities and conditions that can be deployed to the server after including them
within the safe list To do this, complete the following steps:
1 Create the activity or condition in Visual Studio 2005 Designer, compile it as a
strong-named assembly, and deploy it to the global assembly cache (GAC)
Trang 251038 Part VI Extending Microsoft Office SharePoint Server 2007
2 Add the activity or condition to the action safe list in the Web.config file of a
Share-Point virtual server The Web.config file can be found at the following location:
[drive letter]:\inetpub\wwwroot\wss\virtualdirectories Locate the <SafeControls>
section in the Web.config file, and add another SafeControl element, which lookslike this:
<SafeControl Assembly="[assembly name], Version=[version number],
Culture=neutral, PublicKeyToken=[public key token]"
Namespace="[namespace name]" TypeName="*" Safe="True" />
Note .NET assemblies that contain code always have their Culture attribute set to neutral.
3 Go to the Wss.actions file that is located in the following folder: [drive
letter]:\Pro-gram Files\Common Files\Microsoft Shared\web server PLATE\1033\Workflow In this file, you have to add an Action element, rules, andparameters before the action or condition appears in the SharePoint Designer 2007user interface The Action element provides Visual Studio 2005 with all the infor-mation it requires to appear and function correctly in the Visual Studio 2005 userinterface The following code listing shows a sample Action element:
extensions\12\TEM-<Action Name="MyTestActivity" ClassName="[class name]"
Assembly="[assembly name], Version=1.0.0.0, Culture=neutral,
PublicKeyToken=[public key token]" Category="Core Actions"
AppliesTo="all"></Action>
After completing all steps, the custom activity MyTestActivity is added to the Actions list
of the Workflow Designer, as shown in Figure 28-16
Note For more information about configuring web.config files and signing an assembly with a strong name, see Chapter 31 of this book
Trang 26Chapter 28 Implementing Microsoft Windows Workflow Services 1039
Figure 28-16 The custom activity MyTestActivity is added to the Actions list
Extending Built-in Business Document Workflows
In addition to creating custom workflows by using the Workflow Designer that is
included in SharePoint Designer 2007, you can also extend the built-in business
docu-ment workflows that are included in SharePoint Designer 2007 Chapter 9, “Docudocu-ment
Management,” explains which document workflows are available out of the box in
Share-Point Designer 2007 You can use ShareShare-Point Designer 2007 to edit the workflow tasks
that are shipped with SharePoint Designer 2007 You can find these workflow tasks in the
Workflow Tasks folder located in the root of the SharePoint site The following list
pro-vides an overview of these workflow tasks:
■ Active.aspx This file shows all active workflow items in the tasks list
■ AllItems.aspx This file shows all workflow tasks in the tasks list
■ Byowner.aspx This file shows all the workflow tasks that you own in the list
■ DispForm.aspx This file shows the contents of the workflow task after you click
on a workflow task
■ Duetoday.aspx This file shows all the workflow tasks that are due today
■ EditForm.aspx This file shows the editable contents of the workflow task
Trang 271040 Part VI Extending Microsoft Office SharePoint Server 2007
■ myGrTsks.aspx This file shows all the workflow tasks assigned to your team in thetasks list
■ MyItems.aspx This file show all the workflow items assigned to you in the taskslist
■ NewForm.aspx This file shows the new item page that allows you to create a newtask item
Deploying a Workflow Created with Visual Studio
2005 Designer
If a workflow is created using the Workflow Designer of SharePoint Designer 2007,deployment is simple If a workflow is created by using Visual Studio 2005 Designer forWindows Workflow Foundation, you have to deploy and activate the workflow before itcan be used For more information about using Visual Studio 2005 Designer for Win-
dows Workflow Foundation to create workflows, see http://msdn2.microsoft.com/en-us/
<?xml version="1.0" encoding="utf-8"?>
<Feature Id="[guid]" Title="[workflow template title]"
Description="[workflow description]" Version="1.0.0.0"
Scope="Site"
ReceiverAssembly="Microsoft.Office.Workflow.Feature, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
ReceiverClass="Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver" xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="[workflow definition file]" />
</ElementManifests>
<Properties>
Trang 28Chapter 28 Implementing Microsoft Windows Workflow Services 1041
<Property Key="GloballyAvailable" Value="true" />
<Property Key="RegisterForms" Value="*.xsn" />
</Properties>
</Feature>
■ A workflow definition file (by default, called Workflow.xml) must be present to
pro-vide SharePoint Designer 2007 with information that is necessary to instantiate
and run the workflow The creation of a Workflow.xml file is a developer task It is
advisable to open the workflow definition file to check its contents The following
code listing shows a sample Workflow.xml file:
CodeBesideAssembly="[namespace], Version=1.0.0.0, Culture=neutral,
PublicKeyToken=[public key token]"
Note For more information about feature definition (Feature.xml) files, see
http://msdn2.microsoft.com/en-us/library/ms475601.aspx, and for more information
about workflow definition (Workflow.xml) files, see
http://msdn2.microsoft.com/en-us/library/ms439134.aspx
If the feature definition and workflow definition files are present and valid and the
work-flow assembly is strongly named, the workwork-flow is almost ready to be deployed Next, you
need to customize the Install.bat file that is used in deployment to ensure that running
this batch file will deploy the workflow files to the correct location, copy the workflow
assembly to the Global Assembly cache, and activate the workflow in SharePoint
Designer 2007 The Install.bat file is included in the Workflow Developer Starter Kit for
Windows SharePoint Services 3.0 The developer who created the workflow should be
able to provide this Install.bat file to you as well
Note Solution providers, independent software vendors, value-added resellers,
and other developers that want to write custom workflows for SharePoint
Designer 2007 should download the Workflow Developer Starter Kit for Windows
SharePoint Services 3.0 from
http://www.microsoft.com/downloads/details.aspx?fam-ilyid=5DDF902D-95B1-4640-B9E4-45440DC388D9&displaylang=en This starter kit
Trang 291042 Part VI Extending Microsoft Office SharePoint Server 2007
contains Visual Studio project templates for building SharePoint sequential flow libraries, SharePoint state machine workflow libraries, and samples The
work-starter kit requires that the following applications are installed: Visual Studio 2005, SharePoint Server 2007, the Windows Workflow Foundation Runtime compo-
nents, and Visual Studio 2005 Extensions for Windows Workflow Foundation
Performing Deployment and Activation
Open the Install.bat file, and replace the placeholder text with the information takenfrom the workflow project This encompasses the following information:
■ The feature directory name
■ The feature XML file name
■ The workflow definition XML file name
■ The name and relative path of the compiled workflow assembly
During the deployment process, the Install.bat file will do the following things:
■ Create a feature directory at the appropriate location on the server
■ Copy the feature definition file, workflow definition file, and InfoPath form files (ifpresent) into the feature directory
■ Copy the compiled workflow assembly into the GAC
■ Activate the feature in SharePoint Designer 2007
Post-Deployment Tasks
After deployment, you can associate this custom workflow with the lists and libraries thatare located on the SharePoint site that contains the activated feature for the custom work-flow To accomplish this, follow these steps:
1 Browse to the SharePoint site, and go to a list or library.
2 Click List/Document Library settings and then click Workflow Settings in the
Per-missions And Policies section
3 Choose the custom workflow that was created in Visual Studio 2005 Designer from
the Select A Workflow Template check box
Trang 30Chapter 28 Implementing Microsoft Windows Workflow Services 1043
Summary
This chapter starts with an explanation of the available tools for creating workflows in
SharePoint 2007 Then, this chapter provided an overview of the architecture of Windows
Workflow Foundation in a SharePoint Designer 2007 context The chapter also
dis-cussed the workflow markup language (XOML) Also, the chapter describes the
differ-ences between Visual Studio 2005 Designer and SharePoint Designer 2007 when it
comes to creating workflows You have learned how to build a workflow step by step
using SharePoint Designer 2007 and have seen which conditions and actions are
avail-able out of the box to be included in your workflows You have also seen how to use
cus-tom activities and extend built-in document workflows Finally, the chapter discussed
how to deploy a workflow created with Visual Studio 2005
In the next chapter, you will learn about the feature set comprised in the Web Parts that
are available out-of-the-box in SharePoint Server 2007
Trang 32Chapter 29
Microsoft Office SharePoint
Server 2007 Web Parts
Creating and Modifying Web Part Pages 1045
Arranging Web Parts on a Page 1051
Connecting Web Parts 1055
Customizing and Personalizing Web Parts 1056
Summary of Built-In Web Parts 1057
Summary 1071
One of the most compelling reasons to purchase Microsoft Office SharePoint Server 2007
is the plethora of Web Parts that ship with this product Some of these Web Parts form an
overall feature that users will find very beneficial in their daily jobs
A Web Part page is a special Web page that is configured with one or more Web Part
zones that can host Web Parts These zones can only be created on Web Part pages You
can think of Web Parts as individual units of code that are responsible for presenting data
in customized views through the user’s browser A Web Part can be a prebuilt module or
one of custom design Either way, the modular structure of a Web Part allows simple
manipulation and organization of information and functionalities on Web Part pages
This chapter will describe the individual functions and proper use of the Web Parts that
come with Office SharePoint Server 2007
Creating and Modifying Web Part Pages
When a site is created in SharePoint Server 2007, the home page is automatically a Web
Part page Each site template contains a set of default Web Parts The most commonly
used Web Part page template comes with the team site A Web Part page is a content layout
page that is used in conjunction with a master page to create the Web page that is
ren-dered by the client’s browser
Trang 331046 Part VI Extending Microsoft Office SharePoint Server 2007
Some possible functions of Web Parts on pages and sites are as follows:
■ To consolidate data
■ To display text and images
■ To promote collaboration and communication
Note You can use Microsoft Office SharePoint Designer 2007 to create a Web Part page from scratch
To understand how Web Parts work, you will create a blank Web Part page Later, you willadd and modify Web Parts on that page To create a blank Web Part page, follow thesesteps:
1 Starting from a site, on the Site Actions menu, click Create
2 In the Web Pages section, choose Web Part Page.
3 In the Name box, type a name for the new Web Part Page This will become the file
name, with an aspx extension
4 Select a layout template There are eight templates to choose from, all with different
Web Part zone layouts
More Info For more information about zones, see the “Arranging Web Parts on a Page” section later in this chapter
5 In the Save Location section, choose a document library to save this new file in and
click Create
Note If a document library does not already exist on the site, you will be prompted to create one
The new Web Part Page is generated and appears in edit mode, which was referred to as
design mode in SharePoint Server 2003.
Figure 29-1 is a team site with four Web Parts The Web Parts are inside two Web Partzones that are labeled Left and Right There is also an Add A Web Part button at the top
of each zone Notice the text at the top of the page that lets you know that you are editingthe Shared Version of the page
Trang 34Chapter 29 Microsoft Office SharePoint Server 2007 Web Parts 1047
Figure 29-1 A Web Part page
More Info For more information about shared and personal versions, see the
“Customizing and Personalizing Web Parts” section later in this chapter
Adding Web Parts to a Page
A page must be in edit mode to add and modify Web Parts You can enter edit mode by
clicking Site Actions and then selecting Edit Page Once you’re in edit mode, there are two
basic methods for adding Web Parts:
■ The Add Web Parts dialog box
■ Drag-and-drop from the Web Part tool pane
The following describes how to switch a page to edit mode and add a Web Part:
1 On the Site Actions menu, click Edit Page
2 Edit mode is indicated by an Exit Edit Mode link under the Site Actions list.
3 Click the Add A Web Part button and the Add Web Parts dialog box appears This
box displays all Web Parts, listed in groups, and is shown in Figure 29-2
Trang 351048 Part VI Extending Microsoft Office SharePoint Server 2007
Figure 29-2 Add Web Parts dialog box
4 Select two Web Parts and click Add.
Figure 29-2 shows the Suggested Web Parts screen that automatically groups and filtersthe Web Parts the system interprets to be the most likely choices for the type of Web Partpage with which you’re working Notice that you can get to the Web Part tool pane byclicking the Advanced Web Part Gallery And Options link This Web Part tool pane isshown in Figure 29-3
Figure 29-3 Web Part tool pane
Trang 36Chapter 29 Microsoft Office SharePoint Server 2007 Web Parts 1049
The Web Part tool pane is the second way to add Web Parts to a Web Part page In this
tool pane, the Web Parts are listed alphabetically
Note If the Add and Cancel buttons do not display at the bottom right of the
Add Web Parts dialog box, collapse and expand the Lists And Libraries section
The Add button will appear at the bottom right of this screen
Using the Web Part Gallery and Advanced Options
Other than the basic way of browsing for them, there are several ways to obtain Web Parts
to add them to the page This section will cover the more advanced options of adding
Web Parts from the Web Parts tool pane
Browse, Search, and Import are the three methods for finding a Web Part In the top
tool-bar of the Web Part tool pane, click the down arrow, and a menu box for Browse, Search,
and Import will appear
Browse
The Web Part tool pane shows an alphabetical list of all Web Parts for the site collection,
ten at a time You can see the next 10 Web Parts in the list by clicking the Next link at the
bottom of the tool pane
Search
Besides scrolling through a long list of Web Parts, one page at a time, another way to find
a Web Part is to use the Search feature The titles and descriptions of all Web Parts in the
site collection will be searched, with results displayed
Import
This feature is useful when you need a Web Part that does not exist in the site collection
You can use this feature to import an existing Web Part from a file share into the Web Part
gallery The file extensions for Web Parts are webpart or dwp Web Parts can be
imported into the gallery by performing the following steps:
1 Navigate to the home page of the site collection by clicking the link at the top left of
the screen
2 Click the Site Actions menu, click Site Settings, and choose Modify All Site Settings
3 In the Galleries section, select Web Parts This page lists detailed file information
about every Web Part
4 To upload Web Parts for the site collection, click Upload on the toolbar, browse to
.dwp or webpart files, and click OK
The Web Part you wanted to import should now appear in the list of Web Parts for the
site
Trang 371050 Part VI Extending Microsoft Office SharePoint Server 2007
Web Part Galleries
Web Part galleries are groups of Web Parts that are helpful in locating a specific Web Part
Referring back to Figure 29-3, three galleries are shown: Closed Web Parts, Site Name
Gal-lery, and Server Gallery There is a fourth gallery called the Online GalGal-lery, which can beturned on or off in the Web application’s properties in Central Administration This gal-lery is not illustrated in Figure 29-3
■ Closed Web Parts This is a list of Web Parts that previously existed on the pagebut have been removed
■ Site Name Gallery The default location for all Web Parts in the site collection Thename is based on the site collection’s name
■ Server Gallery This is a list of Web Parts available for all site collections in theWeb application Navigate to the virtual server in the SharePoint Server 2007server’s file system, create a new folder called “wpcatalog,” and copy the dwp and.webpart files to that folder
■ Online Gallery This is a collection of Microsoft MSNBC Web Parts located on theInternet By default, this feature is enabled for each virtual server, but it can beturned off To turn this feature off, go to SharePoint Central Administration andaccess the Application Management tab Under Application Security, choose Secu-rity For Web Part Pages In the Online Web Part Gallery section, choose the option
to prevent access to it
Managing the Online Web Part Gallery
An enabled online gallery will cause a performance hit on the server, which might
be obvious when navigating the Web Part tool pane This is due to the server trying
to access the MSNBC online Web Part gallery When the server tries to access thisWeb Part gallery, there is usually a 10 to 20-second delay in the Web Part tool paneappearing while the server tries to build the Web Part list in the online Web Part gal-lery
If you want the MSNBC Web Parts for your deployment, best practice is to load them to your server and offer them as part of another, local gallery Then gointo Central Administration and turn off the online Web Part gallery for each Webapplication This will increase performance and still allow your users to use thesefree Web Parts from MSNBC
Trang 38down-Chapter 29 Microsoft Office SharePoint Server 2007 Web Parts 1051
Web Part List Filtering
To access the Web Part list filter, click the Filter button in the Web Part tool pane, which
was shown in Figure 29-3 This will elicit a new drop-down box, listing the different types
of Web Part groups for filtering
Exporting Web Parts
Exporting Web Parts is very useful when there is a need to copy a Web Part to another
location Web Parts can be exported in a couple of ways:
Note List View Web Parts cannot be exported because they are specific to the
site
■ Site-collection level In the site collection’s Web Part gallery, find the Web Part to
be exported and click the edit icon Next, click Export in the toolbar, and save the
file to your hard drive Then copy the Web Part to a file share from where the other
site administrators can import the Web Part into their galleries
■ Site/Page level Exporting Web Parts at this level lets you retain Web Part settings
or customizations This allows an identical Web Part to be placed on another page
For example, this feature can be used in a case where a Content Editor Web Part has
been customized with a lot of text and graphics and needs to be used “as is” on
mul-tiple pages The following steps demonstrate how to export a Content Editor Web
Part:
1 Add the Content Editor Web Part to a page, and customize it with text and a
table or image
2 On the Web Part menu, choose Export.
3 Save this dwp file to your computer’s file system.
More Info For information on importing, see the “Import” section earlier in
this chapter
Arranging Web Parts on a Page
Web Part zones are storage units used to accommodate and organize Web Parts on a Web
Part page These are sections of the page layout where Web Parts can be placed Multiple
Web Parts can be positioned vertically in each zone
Trang 391052 Part VI Extending Microsoft Office SharePoint Server 2007
Note Zones are pre-programmed within the page template that is used to ate the page The only way to modify the zones on a page is to edit the site using Microsoft SharePoint Designer 2007 or Visual Studio NET
cre-Methods of Arranging Web Parts
Once Web Parts are added to a page, there are two methods for re-arranging them Themethods consist of performing a drag-and-drop operation or using the Web Part toolpane to modify the settings, as detailed in the following list:
■ Drag and drop This is the quickest and most commonly used method In editmode, the cursor changes to a four-headed arrow when it hovers over a Web Part’stoolbar Drag and drop Web Parts from zone to zone, or up and down within thesame zone
■ Modify settings On the Web Part toolbar, click Edit, which is a drop-down menucalled the Web Part menu Choose Modify Shared Web Part Expand the Layoutsection in the Web Part tool pane Modify the Web Part’s location on the page bychanging the Zone and Zone Index fields
Removing Web Parts
Removing Web Parts is simple While in edit mode, click the X at the top right of the WebPart, or choose Delete in the Web Part menu
Modifying Web Part Settings
The edit menu options of a Web Part depend on the advanced settings of the Web Part
By default, the options are Minimize, Close, Delete, Modify Shared Web Part, Export,Connections, and Help
Web Part Properties
To access the properties of a Web Part, click the Edit menu in the Web Part Some erties are common throughout the various Web Parts, such as appearance, layout, andadvanced Besides the common properties, most Web Parts have custom properties thatare listed either before or after the common properties
prop-List Views
The List View is a template using a standard set of Web Part tool pane settings For ple, lists and libraries use this template In list views, you can edit the current view orselect a view that already exists for that list
Trang 40exam-Chapter 29 Microsoft Office SharePoint Server 2007 Web Parts 1053
Figure 29-4 shows the List Views tool pane The Selected View field contains a
drop-down list of choices of the user-defined views that exist for the library, plus Current View
and Summary View Use the Edit The Current View button to customize the current view
within the Web Part When an existing view is selected, edited, and saved, that edited
ver-sion becomes the Current View
Important Switching from the current view to another view listed in the
drop-down list removes changes that have been made to the current view and might
disable Web Part connections that depend on columns in the current view If you
are worried about losing your changes to the current view in the Web Part, you
can create a named view in that list or library This way, your custom view is
named and saved, and it will be an option in the Selected View drop-down list
Figure 29-4 List View tool pane settings
The Toolbar Type is used to specify the manner in which the Web Part toolbar is
dis-played Full Toolbar, Summary Toolbar, and No Toolbar are the options Table 29-1 lists
the available appearance properties of each Web Part in the Web Part tool pane
Table 29-1 Appearance
Property Description
Title This is the text that shows in the Web Part title bar Modifying this does not
influence the name of the item, such as the document library name
Height & Width This specifies the number of pixels or allows the Web Part to adjust itself
automatically to fit the zone
Chrome State The choices are Minimized or Normal When the chrome state is minimized,
only the title bar of the Web Part is displayed