Sie sind auf Seite 1von 104

Integrating InfoPath Forms

Paul Baker
About the Speaker….
Paul Baker
Director of Educational Innovation
Perse School, Cambridge
http://www.perse.co.uk
pdbaker@perse.co.uk
The Perse School regularly features in the top
25 schools nationally. Our commitment to
producing happy and successful students
leads to positive, focused work on how ICT
can contribute to learning and strong
community.
About the Speaker….
Paul Baker

p_d_baker
mathstweets
I‟m interested in
SharePoint
Virtual Learning Tools
SCORM Learning Banks
Microsoft Reporting Services
Parent Communication
A long way to go
….forward together
EASN : East Anglia SharePoint Network for
schools
http://www.easn.org.uk
Sharing ideas and work in progress
Sharing between independent and state
schools
What is Microsoft InfoPath?
What
Content
is Microsoft
Slide InfoPath?
an application used to develop XML-based data entry
forms.

To use InfoPath to fill in a form, a user must have a


designer develop an InfoPath template first.

The most common usage of InfoPath is to integrate it


with Microsoft SharePoint.

In SharePoint, a "Form Library" can be created and


developed by using InfoPath. InfoPath fields will be
exported as "Columns" in the library.
Requirements
Content Slide
InfoPath 2007
Included in Office 2007 Ultimate and the volume license
editions, Professional Plus, Enterprise, and sold separately

InfoPath 2010
Included in Office 2010 Professional Plus

WSS/SharePoint 2007/2010 to host “form


libraries”

SharePoint Enterprise
for InfoPath form services functionality.
(Or as the separate Office Forms Server 2007 product.)
Example
Designed using Controls

Drag and
Drop
Published
to make available
InfoPath is XML-based
Designing a form means defining an xml structure and
a user interface to interact with that structure.

Behind the scenes the structure is defined using a


schema

InfoPath calls that structure and the data that it


contains when being completed the “main data
source”
InfoPath is XML-based
InfoPath is XML-based

If extracted…
InfoPath is XML-based
When a form is completed and saved then that data is
saved as a single xml file, preferably into a sharepoint
forms library that can read the contents of the file
directly.

That xml file contains a reference to the location of


the xsn file so that if it is opened again it can display
the data in the original view.
InfoPath is XML-based
In a SharePoint forms library, content of xml
documents can be collated and displayed in
columns in real time.
InfoPath is XML-based
Data is well defined 
Data can be accessed and transformed or
summarised easily 
Validation can be applied 
Routing can be applied conditionally 
Stepping on from Word
Stepping on from Word
Case Study 1 : Annual Fund Application
Case Study 1 : Annual Fund Application
Case Study 1 : Annual Fund Application
Case Study 1 : Annual Fund Application
Case Study 1 : Annual Fund Application
Case Study 1 : Annual Fund Application
Case Study 1 : Annual Fund Application
Case Study 1 : Annual Fund Application
Case Study 2 : Driver Declaration Forms
Case Study 2 : Driver Declaration Forms
Case Study 2 : Driver Declaration Forms
Case Study 2 : Driver Declaration Forms
Case Study 2 : Driver Declaration Forms
Case Study 2 : Driver Declaration Forms
Case Study 2 : Driver Declaration Forms
Case Study 2 : Driver Declaration Forms
Case Study 2 : Driver Declaration Forms
Case Study 3 : ParentPay Requests
Case Study 3 : ParentPay Requests
Case Study 3 : ParentPay Requests
Case Study 3 : ParentPay Requests
Case Study 3 : ParentPay Requests
Case Study 3 : ParentPay Requests
Case Study 3 : ParentPay Requests
Case Study 3 : ParentPay Requests
Designing an InfoPath form.
Adding validation and configuring views.
Publishing options and property promotion.
Save vs Submit

PLACE DEMO TITLE HERE


Completing a form
Email options.
InfoPath Samples
InfoPath does Data Connections
Data Connections can be for receiving or submitting
data.

Connections can be to SQL Server or Access databases,


Web Services, SharePoint List or Library or another
XML document.

Defining a connection creates another “Data Source”


in the InfoPath document.
Data Connection Templates
InfoPath provides form templates to quickly configure
forms whose data structure is determined by an
external data source...

...from a database, a web service or an xml


document.

These templates „lock‟ your main data source schema


to be consistent with the data source you are
connection to.

Limited functionality for writing back to the data


source unless SQL Server or using code.
Using a Data Connection Template
PLACE DEMO TITL HERE
Binding a drop down list row items
Using The Submit Button
Create „Merged‟ InfoPath Docs without Data Conn
VBA - Access
Public Sub exportXML()
Dim strStaffCode As String, filename As String, strPath As String
strPath = "C:\Users\pdbaker\Documents\SharePoint\LearningGateway2010\DemoDatabase2\"
strStaffCode = "MCS"
filename = strStaffCode & ".xml"

Application.exportXML _
ObjectType:=acExportQuery, _
DataSource:="UCASComment", _
DataTarget:=strPath & "raw-" & filename, _
WhereCondition:="StaffCode='" & strStaffCode & "'"

Transform _
sourceFile:=strPath & "raw-" & filename, _
stylesheetFile:=strPath & "InfoPath.xsl", _
resultFile:=strPath & filename

End Sub

Private Sub Transform(sourceFile, stylesheetFile, resultFile)


' courtesy of
http://www.oreillynet.com/xml/blog/2005/04/transforming_xml_in_microsoft.html
Transform Stylesheets
Download an “identity transformation” and then modify the root template to include the InfoPath processing
instructions.

<xsl:template match="/">
<xsl:processing-instruction name="mso-infoPathSolution">
<xsl:text>
solutionVersion="1.0.0.4"
productVersion="12.0.0"
PIVersion="1.0.0.0“ href="file:///C:\UCASComments.xsn"
name="urn:schemas-microsoft-com:office:infopath:UCASComments:-myXSD-2010-07-
09T19-58-45"
</xsl:text>
</xsl:processing-instruction>

<xsl:processing-instruction name="mso-application">
<xsl:text>
progid="InfoPath.Document"
versionProgid="InfoPath.Document.2"
</xsl:text>
</xsl:processing-instruction>

<xsl:apply-templates select="node()"/>
</xsl:template>
LINQ in C# - Visual Studio
XDocument xml = XDocument.Load(txtFile.Text);
XNamespace ns =
"http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-07-10T19:35:48";

var query =
(from p in xml.Elements(ns + "UCASComments").Elements(ns + "UCASComment")
select p.Element(ns + "StaffCode").Value).Distinct();

foreach (var record in query)


{
XDocument xmlOutput = XDocument.Load(txtFile.Text);
var queryRemove =
(from p in xmlOutput.Elements(ns + "UCASComments").Elements(ns+"UCASComment")
where p.Element(ns+"StaffCode").Value != record
select p);

queryRemove.Remove();
xmlOutput.Save(txtOutput.Text + @"\" + record + @".xml");
}
Submit options
Case Study 4 : Pupil Progress/Tracking
Bound to web services

Our MIS
(WCBS PASS)

Code, form, email addresses


of student and teacher which
came from same web
service is separated into
fields.
[WebMethod]
public XmlDocument getFilteredStudents(string StartsWith)
{
DBQuery dbq = new DBQuery();
QueryParamCollection qpColl = new QueryParamCollection();
string param = StartsWith.Trim();
param += param.EndsWith(@"%")?"":@"%";
qpColl.Add(new QueryParam("@StartsWith",param));
XmlDocument result =
dbq.executeXMLDocument("zzGetStudentsFilteredXML",dbq.Connection,qpColl);
return result;
}
[WebMethod]
public XmlDocument getFilteredStudents(string StartsWith)
{
DBQuery dbq = new DBQuery();
QueryParamCollection qpColl = new QueryParamCollection();
string param = StartsWith.Trim();
param += param.EndsWith(@"%")?"":@"%";
qpColl.Add(new QueryParam("@StartsWith",param));
XmlDocument result =
dbq.executeXMLDocument("zzGetStudentsFilteredXML",dbq.Connection,qpColl);
return result;
}
CREATE PROCEDURE [dbo].[zzGetStudentsFilteredXML]
@StartsWith VARCHAR(21)
AS
(
SELECT 1 as Tag,
NULL as Parent,
'1' as [outertag!1!id],
null as [pupil!2!id],
null as [pupil!2!name!element],
null as [pupil!2!code!element],
null as [pupil!2!form!element],

UNION

SELECT 2 as Tag,
1 as Parent,
'1' as [outertag!1!id],
PUPIL_ID AS [pupil!2!id],
SURNAME + ',' + PREFERRED_NAME + ' (' + [FORM] + ')' AS [pupil!2!name!element],
CODE AS [pupil!2!code!element],
ISNULL([FORM], "NA") AS [pupil!2!form!element]

FROM Curr_Pupils_Curr_Year
WHERE SUB_SCHOOL='UPPER'
AND SURNAME LIKE @StartsWith
)

ORDER BY [pupil!2!name!element]
FOR XML EXPLICIT
Submit button which
submits first to PASS and
then also to a sharepoint
document library.

Our MIS
(WCBS PASS)

SP creates email
notifications and allows a
secretary to retrieve and
file any documentation
onto the pupil record.
[SUBMIT]

WORKFLOW
(SHAREPOINT DESIGNER)

EMAILS
Lookup from another
SharePoint List
which stores extra staff that
want to be notified on the
form group level.
(e.g. Head of year)
Case Study 5 : Perse Quiz Project
Case Study 5 : Perse Quiz Project
Case Study 5 : Perse Quiz Project
Case Study 5 : Perse Quiz Project
Case Study 5 : Perse Quiz Project
Case Study 5 : Perse Quiz Project
Images are extracted from the xml when it is submitted to the web service and replaced with
the filename of the image. The XML is then just saved, ready to be displayed as a quiz using a
stylesheet transform when the quiz is requested.
InfoPath does code
You can attach code to buttons, form events
and control events

Can be written in C#,VB, Jscript or VBScript

The interface is VSTA : Visual Studio tools for


applications.

You can control the user interface and also


control and requery the data connections using
the object model.
InfoPath does code
Example: Copy nodes directly from a data
connection to your own main data source.
InfoPath does code
public void btnLoad_Clicked(object sender, ClickedEventArgs e)
{

// Create an XPathNavigator object to navigate the main data source


XPathNavigator xpnMain = MainDataSource.CreateNavigator();
string strFilter = xpnMain.SelectSingleNode("/my:UCASComments/my:txtFilter",
NamespaceManager).Value;

// Retrieve the connection object from the data connection


AdoQueryConnection myConn = (AdoQueryConnection)(DataSources["qryUCAS"].QueryConnection);
myConn.Command =
@"select [StaffCode],[Department],[Pupil Name] as [PupilName],[Yeargroup]
from [qryUCAS] as [qryUCAS]
where [StaffCode] like '" + strFilter + "%'";
myConn.Execute();

// Delete current ucas comments from the main data source


XPathNavigator xpnOld;
do {
xpnOld = xpnMain.SelectSingleNode("/my:UCASComments/my:UCASComment", NamespaceManager);
if(xpnOld!=null)
xpnOld.DeleteSelf();
} while (xpnOld!=null);

....continued next slide


InfoPath does code
// Create an XPathNavigator object to navigate the data connection
XPathNavigator xpnDConn = DataSources["qryUCAS"].CreateNavigator();
XPathNodeIterator xpnNewNodes = xpnDConn.Select("/dfs:myFields/dfs:dataFields/d:qryUCAS", NamespaceManager);

XPathNavigator xpnUCASComments = xpnMain.SelectSingleNode("/my:UCASComments", NamespaceManager);


string nspace = xpnUCASComments.NamespaceURI;
foreach(XPathNavigator xpnNew in xpnNewNodes)
{
XmlWriter writer = xpnUCASComments.PrependChild();
writer.WriteStartElement("my", "UCASComment", nspace);
writer.WriteElementString("my", "StaffCode",nspace, xpnNew.SelectSingleNode("@StaffCode").Value);
writer.WriteElementString("my", "Department", nspace, xpnNew.SelectSingleNode("@Department").Value);
writer.WriteElementString("my", "PupilName", nspace, xpnNew.SelectSingleNode("@PupilName").Value);
writer.WriteElementString("my", "Yeargroup", nspace, xpnNew.SelectSingleNode("@Yeargroup").Value);
writer.WriteElementString("my", "Comment", nspace, "");
writer.WriteEndElement();
writer.Close();
}
}
Tool Tie-ins
Parent Communication : www.schoolpost.co.uk
Tool Tie-ins
Parent Communication : www.schoolpost.co.uk
Tool Tie-ins
Parent Communication : www.schoolpost.co.uk
Tool Tie-ins
Parent Communication : www.schoolpost.co.uk
Tool Tie-ins
Parent Communication : www.schoolpost.co.uk

?
Tool Tie-ins
Workflow Tools

• Visual Studio
• SharePoint Designer
• Visio
• Nintex
Tool Tie-ins
Microsoft Reporting Services
Tool Tie-ins
Microsoft Reporting Services
Tips and Tricks
Digital signatures
Can enable digital signatures on sections of the form
And when applied can make the form „read only‟
But requires a certification authority or Windows Server acting in
this role or self-certified (but the latter is not secure and requires
access to the certificates snap-in of mmc to update/delete.)
Digital signatures
Perhaps Workflows and “Contact Selector” controls are better
When submitted then if it is missing an HOD signature then the
workflow generates an email to the HOD with the link to the
submitted form.
When both boxes are ticked then the workflow generates an
„acknowledgement‟ email to both parties and rules can make the
form read only.
In the SharePoint Library, the “Last Modified By” will be the HOD.
InfoPath Form Services
Hosts the InfoPath form in the browser...
...so clients don‟t need the application installed.

Limits the functionality that you can use. Needs to be more „standard‟ and
doesn‟t support certain controls (e.g. attachment or image control or
bulleted list) and restrictions on code, rules, filters etc.
http://office.microsoft.com/en-us/infopath-help/infopath-2007-features-
that-are-unavailable-in-infopath-forms-services-
HA010210587.aspx?CTT=3#BM4

Requires SharePoint Enterprise

With more detailed forms it is probably still better to be designing on a


client application that can be saved at regular intervals to your hard drive
and doesn‟t „rely‟

Free, widely distributed client app would be perfect


Are Microsoft heading in that direction?
Contact Selector

http://www.sharepointassist.com/2009/02/27/adding-a-contact-
selectorpeople-picker-to-an-infopath-form/
Quick-Start Design
Form Options
Template Parts

E.g. Use with the contact selector to create a “pre-configured” contact selector
Outlook InfoPath Form Folders
Workflow integration
InfoPath 2010

http://blogs.msdn.com/b/infopath/archive/2009/07/15/what-s-new-in-infopath-2010.aspx
InfoPath 2010
Conforms with the Ribbon interface

More pre-built and attractive layouts


InfoPath 2010
New and Improved Controls

New controls in InfoPath 2010 include:

• Picture buttons – Instead of the default gray button, use any image as a button in your
form.
• Hyperlink capabilities –Allow users to insert their own hyperlinks when filling out
forms.
• Date and time picker – Allow users to insert dates and times in their forms
• Person/Group pickers – Updated! This is now a first class control and is included by
default in the Controls gallery.
• Signature Line (Editor Only) – Allow users to digitally sign a form

Controls and functionality that are now supported in browser forms include:

Bulleted, numbered, and plain lists, multiple selection list boxes, Combo boxes, Choice
group and sections, and Filtering functionality.
InfoPath 2010
New and Improved Add Rules to your Forms
With our new out-of-the-box rules (or quick rules) and improved
rules management UI, you can easily add rules to validate data,
format your form, or perform other actions with just a couple of
clicks, and without any code.
InfoPath 2010
Publish Forms Quickly
Our new “quick” publish functionality allows you to publish forms in
a single click (no more clicking through the Publishing Wizard every
time you want to make an update to your forms!)

Create Mashups using the InfoPath Form Web Part


Now, without writing a single line of code, you can host your InfoPath
browser forms in Web pages by simply adding the InfoPath Form
Web Part to a Web Part page. You can also connect it to other Web
Parts on the page to send or receive data.
InfoPath 2010
Create Forms for SharePoint Lists
Using InfoPath, you can now extend and enhance the forms used for creating,
editing and viewing items in a SharePoint list. In a browser, simply navigate to a
SharePoint list, and on the SharePoint Ribbon under List Tools, choose the
Customize Form option. This will automatically generate a form which looks very
similar to the default out-of-the-box SharePoint list form.
You can then customize and enhance this form by
modifying the layout, creating additional views or
pages, and adding rules to validate your data,
show or hide sections of the form or set a fields
value (to name just a few of the options).
InfoPath 2010
Create SharePoint Applications
With InfoPath 2010, SharePoint Server 2010, and SharePoint
Designer 2010, you can easily create powerful team, departmental
or enterprise applications on top of SharePoint Server.

Form-based applications: InfoPath forms can be integrated with


components such as workflow, reporting, and custom Web pages to
create rich form-based applications.

Document Workflows: InfoPath can be used to design custom workflow


initiation and task forms that drive document management processes.

Business Connectivity Services: Integrating with BCS, it is


straightforward to design InfoPath forms that create, read, update,
and delete business data from a back-end system.
InfoPath 2010
InfoPath Editor
The InfoPath 2010 Editor Fluent user interface provides a much
improved, simpler user experience for filling out forms.

Form opened in InfoPath 2010 Editor:


Lessons learnt
Allow/encourage users to save straight away
Allow save with validation errors – use the
„complete‟ technique instead.
Remind users that they can save into “my
documents” if they have connectivity problems
Infopath documents are much more stable than web
forms (which expire/lose connections)
…but do require InfoPath to be installed on the
client.
Lessons learnt
InfoPath form services don‟t support all the
functionality of InfoPath.
Be careful when changing the design of a „live‟ form to
maintain data compatibility with completed forms
where necessary.
You can set up alerts on sharepoint (or workflows
through sharepoint designer) that react to what has
been entered in the form
Make sure you keep the xsn file where it was published
(i.e. don‟t delete the forms library or the folder in the
case of a network share). Otherwise completed forms
can‟t be easily opened.
Q&A
Thank you for attending!

pdbaker@perse.co.uk
http://www.perse.co.uk

Das könnte Ihnen auch gefallen