Introduction 1
Overview of This Book . . . . . . . . . . . .. . . 1
How to Benefit from This Book . . . . . . . . 1
What Is New in This Book? . . . . . . .. . .. . . 2
How to Continue Expanding Your Knowledge . . . . . . 2
Â
Part I: Designing Forms for SharePoint
Â
1 Use InfoPath Designer 2013 3
Why Use an InfoPath Form? . . . . .. . . . 3
What Does InfoPath Do for My Lists? . . . . .. . . 4
Why Use InfoPath Forms in Workflows? . . . . . . . . 4
How Does InfoPath Integrate with My Data? . . . . . . . 4
InfoPath Versus Web Controls and Web Parts . . . . . .. . 5
What Is the InfoPath Web Part? . . . . . . . . . . .. . 5
Getting Started . . . . . . . . 5
Â
2 Create a SharePoint Form with InfoPath Designer 7
Design a SharePoint Form Using the Blank Form Template . . . . . . . . 9
Add Controls. . . . . . . .. . . . . . . . . . . . . 10
Preview Your Form . . . . . . . . . . . . . . 11
Name Your Data Fields . . . . .. . . . . . 12
Add Submit Options . . . . . . . .. . . . . . . . . . 13
Publish Your Form . . . . . . .. . . . . . . . . 15
Use Your Form in SharePoint . . . . . . . . . . 17
Create a Form Library from InfoPath . . . . . . . . . . 18
Design a SharePoint Form Using the SharePoint Form Library Template. . . . .. 20
Â
3 Use SharePoint Form Controls 21
What Are Input Controls?. . . . . . . . . . . . . . . 22
What Are Object Controls? . . . . . . . . . . . .. 23
What Are Container Controls? . . . . . .. . . 24
Drag Controls on Your Form . . . . . . . . . . . 24
Allow Users to Enter Text . . . . . . . . . . . . . . . 25
    Make a Text Box Read-Only . . . . . . . . . 25
    Make a Text Box Multiline . . . . . . .. . . . . 26
Allow Users to Select a Single Selection from a List of Items . . 27
Allow Users to Select Multiple Items from a List of Items . . . 29
Allow Users to Select an Optional Single Choice . . . . 30
Allow Users to Select from Various Options . . . . . . . 31
Allow Users to Enter a Date/Time . . . . . . . . . . . . . . 32
Allow Users to Select a Person . . . . . . . . . . . . 34
Allow Users to Select from a SharePoint External Content Type . . . . . . 35
Allow Users to Initiate an Action . . . . . . . . . . . . . . . . . 35
Show Optional Controls on Your Form . . . . . . . . . . . . . . . . . . . 37
Allow Users to Enter Multiple Instances of the Same Fields . . . . . 37
Allow Users to Choose Which Set of Fields to Use . . . . . . . 38
Make a Control/Field Required . . . . . . . . . . . . . . . 40
Â
4 Create SharePoint Form Rules 41
Hide or Show Controls Based on a Selected Option . . . . . . . . 42
Format an Entry Based on a Condition . . . . . . . . . . . . 45
Implement a Validation Rule . . . . . . . . . . . . . . . 47
Add an Action Rule to a Button . . . . . . . . . . . . . . . . 49
Use Rules for Form Submission . . . . . . . . . . . . . . 50
Use Rules for Form Loading . . . . . . . . . . . . . . . . . . 53
Validate Data Entry Using Patterns . . . . . . . . . . . . . 54
Â
5 SharePoint Form Functions 57
Use the SharePoint URL Functions . . . . . . . . . . . . . . . . . 58
Calculate a Future Date . . . . . . . . . . . . . . . . . . . . . . . . . 59
Get the Current SharePoint User . . . .. . . . . . . . . . . . . 60
Remove Leading and Trailing Spaces from a Field Value . . . . . 63
Remove All Spaces from an Entry . .. . . . . . . . 63
Default a Blank Amount to Zero . . . . . . . . . . . . . . . . 64
Calculate the Sum of All Items . . . . . . . . . . . . . . . . . . . 65
Determine a Count of the Items Entered . . . . .. . . . . 67
Obtain a Portion of an Entered String . . . . . . . . . . 68
Obtain the Username from SharePoint Online (Office 365) . . . . . 69
Add Years to a Date Preserving the Month and Day . . . . . 70
Â
6 Create SharePoint Form Page Designs and Views 71
Change the Current View Name . . . . . . . . . 72
Create a New View . . . . . . . . . . . . . . . . . . . . . . 73
Change the Default View . . . . . . . . . . . . . . . . . . 74
Make a View Read-Only . . . . . . . . . . . . . . . . . . . . 75
Prevent a User from Selecting a View . . . . . . . . 75
Use a View for Printing . . . . . . . . . . . . . . . 77
Use a Different Layout for Your Form . . . . . . . . 77
Use a Theme for Your Form . . . . . . . . . . . . . . . . . . . . 78
Add Headers/Footers to Your Form . . . . . . . . . . . 79
Insert a Table Layout into Your Form . . . . . . . . . . . . . . 80
Modify a Table Layout in Your Form . . . . . . . . . . . . . 80
Â
7 SharePoint List Forms 81
Use a Form to Create a SharePoint List . . . . . . . . . . . 82
Modify the Form of an Existing SharePoint List . . . . . . . . . . 86
Set Your List Form Template Back to the Default Form . . . . . 87
Â
8 Submit and Publish to SharePoint 89
Enable Your Form for Submission . . . . . . . . . 90
Configure Email Submission . . . . . . . . . . . . . 91
Publish Your Form to Email . . . . . . . . . . . . . . . . . . . . 93
Configure SharePoint Library Submission . . . .. . . . . . . . . 96
Publish Your Form to a SharePoint Library . . .. . . . . . . 97
Use Multiple Forms in SharePoint Libraries. . . . . . . . . . 101
Configure Web Service Submission . . .. . . . . . . . . . . . 105
Configure SharePoint Server Connection Submission . . . . . . . 107
Modify the Available Menu Buttons During Form Submission . . . . . 110
Â
Part II: Business Solutions
Â
9 Use Data in SharePoint Forms 113
Use Data From a Database . . . .. . . . . . . . . . . 114
Convert an InfoPath Connection to a SharePoint Connection File . . . 119
Use Data From a SharePoint List . . . .. . . . . . . . . . 121
Use Data From a SharePoint Data Connection File . . . . . . 123
Use Data from a (SOAP) Web Service . . . . . . 124
Populate a Drop-Down List with Data . . . . . . . . . . 126
Populate a Drop-Down List with Data Based on Another Selection (Cascading Drop-Down) . . . . . 129
Display Data from a SharePoint List . . . . . . . . 133
Display a Repeating Table from a SharePoint List . . . . . . . . . 137
Leverage External Data from a SharePoint External Content Type (Business Data Connectivity Services) . . . . 142
Leverage External Data from a REST Web Service . . .. . . . 144
Â
10 Use the InfoPath Form Web Part 151
Add an InfoPath Form Web Part to a SharePoint Web Part Page . . . . 152
Create a Master/Detail Display Form for SharePoint Lists . . 154
Expose Form Fields as Web Part Connection Parameters . . . . 156
Create a Form to Send Data to Web Parts . . . . . . . . . . 158
Â
11 Using Forms in SharePoint Workflows 163
Create a SharePoint Workflow for a Form Library . . . . 164
Include a Link to the Form in an Email . . .. . . . . . . . 168
Add a Task to the Workflow . . . . .. . . . . . . . . . 170
Perform Workflow Actions Based on Form Values . . .. . . . 172
Perform One Workflow Action or Another (But Not Both) . . . . 175
Get a User from a People/Group Picker Control . . . . . . . . 177
Customize the Task Form . . . . . . . . . . . . . . . . . . . . 180
Add Form Parameters Used When Starting Your Workflow . . . . . . 181
Â
12 Enhance the User Experience 183
Display a Read-Only Value . . . . . . . . . . . . . . . . . . . . . . . 184
Compact Sections of Fields/Controls . . . . . . . . . . . . . . . 187
Configure Dynamic Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Make Screen Tips Informative for Validation . . . . . . . . . . . . . 190
Notify the User of Successful Submission . . . . . . . . . . . . . . . . 190
Create a Tabbed Navigation in Your Form . . . . . . . . . . . . . . . 194
Use Pictures as Choices . . . . . . . . . . . . .. . . . . . . . 198
Â
13 Using Template Parts to Create Reusable Form Components 203
Create a New Template Part . . . . . . . . . . . . . 204
Add Common Data Connections . . . . . . . . . . . . . 205
Add Common Controls . . . . . . . . . . . . . . . . . . . . . . 205
Add Common Fields . . . . . . . . . . . . . . . . . . . . . . 205
Save Your Form Template Part . . . . . . . . . . . 206
Add Your Template Part as a Custom Control . . . . . .. . 206
Use Your Template Part as a Control . . . .. . . . . . . 209
Change the Name of Your Custom Control . . . . .. . . . . . . 210
Change the Icon of Your Custom Control . . . . . . . . . . . . 211
Â
Part III: Technical Solutions
Â
14 Customize a Document Information Panel Content Type 213
Create the Document Library . . . . . . . . . 214
Add Columns to Your DIP . . . . . . . . . . 215
Modify the DIP . . . . . . . . . . . . . . . . 218
Â
15 Leverage Visual Studio 2012 with InfoPath 221
Access Your Form Within a Visual Studio Solution . . . . . . . 222
Create an InfoPath 2013 Add-In . . . . . . . . . . . 225
Create a Custom Task Pane . . . . . . .. . . . . . . . . . . 226
Â
16 Dynamically Populate a Repeating Table 229
Set Up the Initial Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Create a Changed Event Method . . . . . . . . . . . . . . . 232
Create a Namespace Variable. . . . . .. . . . . . . . . . . . . . 233
Access the Secondary Data Source . . . . . . . . . . . . . . . 234
Loop Through the Secondary Data Source . . . . . . . . . 235
Populate the Repeating Table . . . . . . . . . . . . . . 236
Clear Previous Entries . . . . . . . . . . . . . . . . . . . . . . . . . . 237
What Does the Final Solution Look Like? . . . . . . . . .. . . . . . . . . . 237
Implement a Nested Repeating Table Solution . . . . . . . . . . . . 239
Â
17 Track Changes in a Form 243
Set Up the Form for Tracking Changes . . . . . . . . . . . . . . . . . 244
Add Changed Event Code for Tracking Changes . . . .. . . . . . . 246
Apply Rich Text to the Entry . . . . . . . . . . . . . . . . . . . . . . . 250
Show Only One Version at a Time . . . . . . . . . . . . . . . . . . . . . 252
Display a Changes Counter. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . 256
Display the User Who Made the Modification . . . . . . . . . . . 257
Â
18 Autogenerate Forms 259
Create a Class Object of Your Form . . . . . . . . . 260
Create Form Generation Code . . . . . . . . . . . . . . . 263
Upload the Form Object to a Form Library . . . . . . 265
Â
Part IV: Administrative Aspects
Â
19 Use Central Administration to Administer InfoPath Forms Services 267
Access the InfoPath Form Services Options . . .. . . . . 268
Browser-Enable Form Templates . . . .. . . . . . . . . . . . . . 269
Throttle Data Connection Timeouts . . . . . . . . . 269
Throttle the Data Connection Response Size . . . .. . . . . . 270
Modify Authentication Settings . . . . .. . . . . . . . . . . . . 271
Configure Session State . . . . . . . . . . . . . . . . . 272
Upload a Form Template . . . . . . . . . . . . . . . . . . 273
    What Happens When a Form Is Uploaded? . . . .. . . . 275
Manage Form Templates . . . . . . . . . . . . . . . 276
    What Happens When a Form Is Activated to a Site Collection? . . . 277
Enable the Web Service Proxy . . . . . . . . . . . . 277
Manage Data Connections . . . . . . . . . . . 279
Â
20 PowerShell 281
Access SharePoint 2013 Management Shell . . .. . . . . . . 282
Browser-Enable Form Templates . . . . . .. . . . . . . . . . . 283
Throttle Data Connection Timeouts . . . . . . . . . . . . . . . 284
Throttle the Data Connection Response Size . . . . . . . . . 284
Modify Authentication Settings . . . . . . . . . . . 285
Configure Session State . . . . . . . . . . . . . 286
Enable View State . . . . . . . . . . . . . . . . . . 287
Verify and Upload a Form Template . . . . . . . . . . . 287
Upload Multiple Form Templates at Once . . . . . . . . . . 288
Activate or Deactivate a Form to a Site Collection . . . . . . . 288
Remove a Form from InfoPath Form Services . . . . . . . . 289
Quiesce a Form from InfoPath Form Services . . . . . . 289
Enable the Web Service Proxy . . . . . . . . . . . . 290
Â
21 Managing Form Permissions 293
Create Unique Permissions on a Form Library . . . . . . . . . 294
Grant Users Permissions . . . . . . . . . . . . . . . . 295
Create a Permission Level for Your Form Library . . . . . . . 296
Edit a Group’s Permission Level . . . . . . . . . . . . . . . 297
Create a Submit-Only Permission Level . . . . . . . . 299
Â
Part V: Troubleshooting
Â
22 General Form Issues 301
Resolve: Issue Accessing Data Source . . . . . . . . . . . . . 302
Resolve: SQL Credential Issue . . . . . . . .. . . . . . . 303
Resolve: Business Data Connectivity Metadata Store Is Currently Unavailable . . . . 304
Resolve: Picker Issue Obtaining Business Data . . .. . . . . 305
Resolve: Missing Business Data Connectivity Services Client Components . . .. . . . 306
Resolve: SharePoint Designer Task List Creation Error . . . . 307
Resolve: Missing Programmability Components . . . . . . . . 308
Resolve: Error Loading the Form . . . . . . . .. . . . . . . 308
Resolve: Security Exception Using Code-Behind . . .. . . . . . . 309
Â
23 Resolve Deployment and Publishing Issues 311
Resolve: No File with URL in This Web . . . .. . . . . . . . 312
Resolve: Form Cannot Be Browser Enabled on Selected Site . . . . . . . . . 312
Resolve: Form Template Has Not Been Published . . . . . . . . . . 314
Â
24 Resolve Form Submission Issues 315
Troubleshoot General Submission Issues . . . . . .. . . . . . . . . 316
Resolve: SharePoint Location Is Read-Only . . . . . . . . . . . . . . . . . 316
Resolve: Document Library Already Contains a File with the Same Name . . . . . 317
Resolve: Errors Submitting to a Web Service . . . . . . . . 318
Â
Part VI: Appendixes
Â
A Auto-Increment Repeating Tables 321
Use the position() Function in a Calculated Value Control . .. . 321
Use the count() Function . . . 321
Use a Counter Field with Form Rules . . . 322
Â
B Upload File Attachments in Forms to a Document Library 323
Form Scenario . . . . . . . . . . 323
Submit Button and Code-Behind Setup . . . . . 323
Event Handler Code . . . . . . . . . 324
Deployment . . . . . . . . . . . . . . . . . . . . . 325
Â
C Add Picture Files to InfoPath 327
Add a Picture as a Resource File . . . . . . . . 327
Use a Resource File Picture . . . . . . . . . . . 328
Â
Index 331