Tag Archives: InfoPath

VIDEO – PowerShell PNP to parse InfoPath XML Attachments

Wanted to share quick tutorial on how to parse InfoPath attachment XML.    Source Form Library contains XML with Base64 encoded attachments which we can parse into local TEMP folder and then upload to destination Document Library. Extract filename and file content for each InfoPath attachment XML node.  Save into subfolders and match original file naming.  Helpful for Office 365 migration and scenarios where InfoPath client is no longer available and users prefer to view attachments directly.

Video, screenshots, and source code below. 

Cheers shades_smile

GitHub Repo








InfoPath – search replace URLs within XSN

Need to migrate forms to another URL?   But not sure how to update many data connections?  Try the script below.

This PowerShell will extract XSN contents to a folder, execute string search replace, and “package” back into CAB format with XSN extension.   A simple way to migrate InfoPath forms to another DNS name for scenarios like AAM Alternate Access Mapping redirection and SharePoint major version upgrade (2007 > 2010 > 2013).

Enjoy!  shades_smile


NOTE – Requires CABARC.EXE  http://stackoverflow.com/questions/3361928/where-can-i-get-the-cabarc-utility



# Update InfoPath form URLs by extracting CAB and performing search replace
Write-Host "Prepare folders..."
md c:\InfoPath\before
md c:\InfoPath\temp
md c:\InfoPath\after
Write-Host "Clean temp..."
Remove-ChildItem c:\InfoPath\temp\*.* -Recurse
Write-Host "Extract XSN... $xsnFile"
cabarc x "c:\InfoPath\before\$xsnFile" *.* c:\InfoPath\temp\
Write-Host "Replace URL..."
$txt = Get-Content c:\InfoPath\temp\Manifest.xsf
$txt |% {$_ -replace "//sharepoint/" "//sharepnt07/"} | Out-File -FilePath "c:\InfoPath\temp\Manifest.xsf" -Encoding UTF8 -Force
Write-Host "package XSN..."
cabarc n "c:\InfoPath\after\$xsnFile" c:\InfoPath\temp\*.*
Write-Host "DONE"


BreezeJS – Edit SQL table with < 100 lines of JS code [VIDEO]

With SharePoint 2013 and industry movement towards the cloud I’ve been exploring JavaScript as a primary way to develop rich applications.

One common challenge is data access.  

With C# I have years of experience with [System.Data] and can perform CRUD against SQL relational databases in my sleep.  Open connection, query, data adapter, fill DataTable, and voila!    Muscle memory. Second nature.  Tried and true methods.   However, in the new client side JS world I had no clue where to begin.

Enter Breeze.


People describe Breeze as “Entity Framework on the client in JavaScript” which sounds simple yet has profound implication for the developer.   CRUD operations, LINQ style query, navigating primary/foreign keys, input validation, caching, batch updates, and more.   That’s a lot to consider and new ideas take time to absorb.   Breeze could potentially replace:

  • ASP.Net (ASPX) web forms
  • ASCX user controls
  • InfoPath forms
  • SharePoint web parts
  • WCF 5.6 data services
  • OData
  • Classic WebAPI


I set out to code an example with a few goals:

  • Create simple SQL schema (two tables – parent/child – one to many)
  • Execute CRUD operations in JS against SQL  tables
  • Leverage JS plugins and NuGet “Install-Package” to load third party components
    • Install-Package breeze.webapi2.ef6
    • Install-Package breeze.angular
    • Install-Package angularjs.core
  • Little code as possible

The whole thing took less than 30 minutes and I edited video down to just 15.    I was impressed by how straightforward and easy the process was.   Breeze# in ASP.Net MVC for the back end WebAPI controller was nearly identical to the Breeze example code.   Add one C# method per entity (SQL table) and Breeze does the rest.  The JS front end took a little more time to understand but was also easy to apply.   Connect  Entity Manager to the Breeze URL and you’re ready for CRUD queries.    Amazing!     Given how easy Breeze is I would be hard pressed to use OData or manually created WebAPI controllers with C# code to query a database.   If you can use Breeze, then use it!    You’ll save lots of effort.

Please leave a comment if you found this helpful.   Thank you!  shades_smile


Watch Video

[BreezeJS and WebAPI – Edit SQL table in JS with less than 100 lines of code]


Download Code












InfoPath tip – detect Security Group with List Item permissions

Yes, everyone says InfoPath is dead … but we’re all still supporting it for a while so I wanted to share one of my favorite tips.  Forms often need role based security at the field level.  Table below with example security matrix.

How can InfoPath detect that?   Don’t some people query SOAP ASMX?   Or even a custom WSP with a custom ASMX?   There is a simpler way with List Item permission.  


  1. Create a new Custom List named “SecurityLevel” with only the default “Title” column.  
  2. Go create the needed SharePoint Groups under Site Permissions.  
  3. Back in “SecurityLevel” add one new item for each SharePoint Group with an identical name.   Hover that item, pull down the menu, and set Item Level Permissions for that group ONLY to have “Read” on that item only.  
  4. With InfoPath Designer edit the XSN Form Template and create a new Data Connection to the list “SecurityLevel” with auto refresh.  
  5. Under Form Load create a rule … if count(SecurityLevel [“Analyst”]) > 0 then set field “SecurityLevel=Analyst”.   
  6. With that in place you are ready to apply formatting rules anywhere needed that use “SecurityLevel” to determine hide/show or read/write.



Now when a user open the InfoPath form, the data connection “SecurityLevel” will only show the items they have access to (which is the same as the SharePoint Group membership!).    Works on MOSS 2007, SharePoint 2010, SharePoint 2013, and Office 365.

Hope this helps.  Please leave a comment if it did.  shades_smile


DOWNLOAD  InfoPath Form – SecurityLevel.xsn >>












Form Library JS – an InfoPath replacement?

Microsoft announced InfoPath will go away in 2023.  It makes sense and they have good reasons.   However, form developers are confused about available options.  I have an idea for the InfoPath Roadmap and would appreciate your feedback in the comments below or Twitter (@spjeff) please.

Why not use JavaScript to create similar XML documents?

When people say “InfoPath” they generally are referring to a three part system outlined below.   InfoPath strictly speaking is the form input experience.  Form Library holds the saved XML output.  SharePoint Designer can then trigger email notifications based on status change.



InfoPath as a form input experience has many limitations based on the server postback and Dot Net architecture.  Just try a large repeating table and watch the slow “Loading…” experience as users click and rules postback to the SharePoint IFS backend.   HTML5 and JavaScript offer new options for client side validation, async loading, mobile touch input, responsive layout, and advanced rendering with framworks like JQueryUI  / Bootstrap / Angular.   That’s awesome form input technology!    However, InfoPath is normally chosen for ease of use and “no code”.   Let’s think about how that conversation might go …

Developer Conversation

DEV1 >  “Hey did you hear Microsoft is retiring InfoPath in 2023?”

DEV2 >  “Yeah, but it’s all we have today so I’ll keep using it.  Not sure what else to use.  Sure would be nice to have HTML5 and cooler input experience.”

DEV1 > “Definitely.  Coding from scratch is a lot of work.  I don’t really want to mess around with SPList REST connections for CRUD or make a SQL database with SVC/OData for simple forms.  My head hurts.”

DEV2>  “True, but I guess we’ll gave to make a schema first then form later.”

DEV1 > “InfoPath saved as XML.   I like XML.  It works well for import/export across all of our systems.   Could we keep XML but ditch InfoPath?”

DEV2 > “Cool idea, but I’m not sure how.”

Why throw out the baby with the bathwater?   


Can’t we make fantastic forms with HTML5/JS and then save back to a Form Library in order to leverage SharePoint for storage, views, and workflow?    Right now this is just an idea.  I don’t yet have a working prototype to show but think it would be straightforward to convert JSON to XML and upload.     InfoPath would still be used but by developers for schema only (define XML structure).   End users would never see it.


Please leave a comment below and let me know if you think this might be practical.  Thanks!   Smile





InfoPath – sample XSN form templates (2007, 2010, 2013)

Below are example form templates from InfoPath 2007 upgraded to the newer 2010 and 2013 versions.  With InfoPath Designer/Filler on the desktop as separate applications these templates were removed.   Hopefully these are helpful to those working on InfoPath 2010 and 2013 for quick start.




NOTE – There has been a lot of talk recently about InfoPath going away.   While that may happen over time, there are still thousands of live forms in production today SharePoint admins must support.   As long as Microsoft includes InfoPath in the Office suite I believe there will be many scenarios where InfoPath makes sense.   Complete an expense report and submit for approval?   Done.  One hour with InfoPath Designer and SharePoint Designer.  No code.  Anyone can support.  Just my two cents.

InfoPath – Repeating Table Select One Primary Row

Need to ask users to select one row in a repeating table?   Then you’ll want to see the screenshots below.  There are four simple components:

  1. Repeating table has “rowNum” with default value formula to dynamically calculate a row number.   “count(../preceding-sibling::*) + 1” can be entered with XPath mode.
  2. Main non-repeating “selectedRow” field outside of the table.  Will store the user selection.
  3. Make Primary” button in the repeating table.  Action rules here update the “selectedRow” number.
  4. icon” section to show the actively selected row.  Formatting rules here show it only when selected.


Now when a user clicks the “Make Primary” the main non-repeating “selectedRow” value will be updated to have the number of the actively selected row.  Formatting rules will hide the button and display a green check mark instead.  This provides user feedback and makes for a more intuitive experience.

Also, this solution could be extended with checkbox icons for a more seamless feel.  Simply change the regular “Make Primary” button to a picture button with an image with an unchecked box.   Then update the section to have an image of a fully checked box.   There are many options to format the active/de-active row display.

xsn16   CLICK HERE to download the XSN file









InfoPath Current User (AND Manager) Profile. Lumbergh Remix!

Recently I needed to get the current user and their manager’s Active Directory profile to auto-populate a form.   Itay Shakury wrote a great blog post titled Get the current user without writing code that covers the first need (current user) by reading UserProfileService.asmx. But I needed more.

xsn16 Download sample form – ADManagerDetails.xsn

The strategy was to use 2 data connections and query the 2nd with the manager user ID from the first.   At that point you can map any document text field to be ready only and get the default value from one of these data connections.


Action Steps

  1. New InfoPath form in design mode
  2. Add 2 receive data connections to http://sharepoint2007/_vti_bin/UserProfileService.asmx
  3. Name them “UserProfile” and “ManagerProfile
  4. Leave the input parameters empty.  It will default to the current user.
  5. Open form Rules and add steps to “re-query” the ManagerProfile:
    1. Set field’s value:  query subtree of ManagerProfile to “Manager” value from UserProfile data tree
    2. Query data connection ManagerProfile.  With the filter set, it will now return different data.
  6. Enjoy and tell your friends.

Video Walkthrough (05:57)

How to build the sample form (above download) in full step-by-step video.  Only 6 minutes!  Well worth the time.  Hot

InfoPath Current User (AND Manager) Profile. Lumbergh Remix! from Jeff Jones on Vimeo.

Hide the “Powered By InfoPath” logo

In working with InfoPath Forms Services in MOSS 2007 I found that the web based form experience is great.  And I like InfoPath but even I don’t want a logo bumper sticker to stare at all day.

By editing “ifsmain.css” on the SharePoint web front end’s 12 hive you can override the system styling to hide this element.   The IE developer toolbar helped me find the CSS class (ToolbarBranding) to add the “display:none” attribute.  Screen shot below.  Open-mouthed


C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATELAYOUTSINCifsmain.css




Return to Top ▲Return to Top ▲