Shiraz Cupala
in

InfoPath Dev

Shiraz Cupala

  • InfoPath Developers Wanted for Microsoft User Research Study

    Microsoft just contacted us about a usability study opportunity. They are looking for InfoPath form developers in the Seattle area for their study. Here are the details... 

    Microsoft's User Research Group is looking for people who develop applications using InfoPath to participate in an upcoming usability study.  If you are interested in new computer technology and would like to have an impact on the final design of a Microsoft product that is still in the development phase, we want to speak with you.

    This study is scheduled to begin the week of January 8th with time slots running approximately 2 hours and scheduled at your convenience.  Each participant will be given a retail item chosen from a list of Microsoft's most popular software/hardware titles. 

    If you are interested in participating or would like more information please email us at uccoord@microsoft.com.

  • How to work with stored procedures by using script in an InfoPath form

    Microsoft has an excellent KB article describing how to call store procedures (SPROCs) from InfoPath using script. A must read for advanced database integration with InfoPath.

    http://support.microsoft.com/kb/827007

    Thanks, Shiraz

  • InfoPath vs. Other Microsoft Technologies

    I frequently am asked to explain the benefits and limitations of InfoPath compared to other Microsoft forms and application techologies. I have drafted a matrix to summarize my thoughts on the matter. This is a work in progress and I'm hoping will generate a lot of comment. There are also some pieces I just don't understand enough (e.g. Excel Server) so it would be great for others to fill in the gaps.

    Technology

    Use

    Pros

    Cons

    InfoPath

    Rich experience and offline for true "forms" and structured documents.

    Custom data gathering applications.

    Rapid iterative design, prototyping, development. Many forms require no code and can be authored by power users. Tight SharePoint integration. Rich Text data.

    Limited UI flexibility. Integrates poorly with existing web portals (separate app launches). End-user machine config inconsistencies cause support issues. Oftentimes IP is an extra install for users and not available outside the enterprise.

    Word

    Rich experience and offline for freeform documents. Long documents.

    Best of breed document authoring and collaboration tool.

    Structured documents possible but very hard to build even for pro devs.

    Excel

    Rich experience and offline for data modeling/analysis.

    Best of breed data/numbers modeling and analysis tool. Handles large quantity of data. Built-in connectivity to back-ends. Easier to customize than Word.

    Limited layout for forms. Structured data limited to tabular format. Hard to customize. Requires pro dev for advanced customization.

    InfoPath Server

    Reach scenarios for government and business working with citizens/customers.

    Design-once for rich/reach use. InfoPath designer tool allows non-devs to author complex forms/structured documents.

    Many limitations right now vs. InfoPath rich-client (e.g. filters). Using this to get rich and reach requires very careful design upfront and will require design limitations. Hard to integrate with existing web portals. Complex security. Licensing confusing, expensive.

    ASP.NET / Web Forms

    Thin experience sufficient, offline not needed.

    Total control. Easy to integrate with web portals.

    Requires web dev / pro dev. Must build all functionality / UI from scratch.

    Excel Server

    I don't know the design point for this product. Reach seems to be the one but not complex apps. Input welcome!

     

     

    WinForm, C#, Etc.

    Custom applications.

    Ultimate control. Complex UI, More rigid security, Controlled Transactions. Custom offline handling. Performance can be optimized for the scenario.

    Advanced pro-dev only. Must build all functionality and all UI from scratch.

    SharePoint Forms (Lists)

    Simple List Tracking

    Fast, lean, easy.

    Very limited UI, logic. No offline.

    As I get input I will update this matrix. Comment away!

     

  • Best way to Link to Forms on Web Pages

    Whenever you want to expose your forms on a web page the tendency is to want to put a plain hyperlink to your XSN form template or XML file. The problem with this ranges from getting lame IE download dialogs all the time to data loss scenarios (see below). The correct way is to do it the way SharePoint does it.

    You want to use script to call the inlaunch.dll which InfoPath installs and registers just for this purpose.

    Key Scenarios:

    1. Open an existing XML form file for editing. - Here you want to use the EditDocument2() method. If you don't then in some cases users can experience dataloss as outlined here: http://www.infopathdev.com/forums/t/6045.aspx
    2. Create a new form from an XSN form template. - For this you call the CreateNewDocument2() method.
    3. Create a new form using an existing XML file as the default data. - For this you use an undocumented feature whereby you pass the URL to your XML file to the same CreateNewDocument2() method. Essentially what it does is open that XML file but forces a SaveAs type behavior.

     

    Brief Code Snippet

    This example is for the second scenario: 

    var strTemplateLocation_New = "http://sitename/folder/template.xsn";
    var strDefaultSaveLocation_New = "
    http://www.example.com";
    function CreateNewXMLDocument()
    {
        // Based on WPQ3combineDocuments()
        var objOpenXMLDoc = new ActiveXObject("SharePoint.OpenXMLDocuments.1");
        var bSuccess = false;
        bSuccess = objOpenXMLDoc.CreateNewDocument2(window , strTemplateLocation_New , strDefaultSaveLocation_New );
    }


    <a onclick="CreateNewXMLDocument(); return false;" style="cursor: pointer;" href="<numbersign>">Create New Blank Form</a>

    Note: where you see href="<numbersign>" you need to put in the # symbol inside the quotes instead.  I can't show that here because the blog posting system reformats it as code. Best is to just download the sample code directly.

    Full Sample Code

    I've uploaded a web page with sample code for all 3 scenarios. Download Example: http://www.infopathdev.com/files/folders/examples/entry41177.aspx

    Some notes on this example:

    • You will need to swap in your XSN or XML urls for the current placeholders for "DocumentLocation" and "TemplateLocation".
    • The use of 'http://www.example.com' is to just force InfoPath to instead ask the user to save into their MyDocuments folder. You can alternatively specify a hard drive location but wildcards won't work. Also both these methods will result in a browser cross-domain security prompt. To eliminate that you would want to use the same server name as in the actual XSN link. If that is a SharePoint site this will result in InfoPath thinking it can save to that location (which may be true). If it's not a SharePoint site then you're in luck because then InfoPath will treat it like the example.com placeholder and force the SaveAs to MyDocuments but without any cross-domain issues/prompt.
    • You'll notice the hyperlinks have hrefs and the script. This is so that if the user wants to right-click download the target they can do this (for example to save an XML file for offline use). I of course substituted # for the XSN link as downloading the XSN locally makes no sense.
    • LIMITATION: If you use this method to link to a file not on the same domain then you will get a cross-domain security yes/no dialog from Internet Explorer and maybe other browsers. It is because script is trying to access a file on another domain. I currently know of no way around this issue.

     

    MSDN OM Documentation

    The following MSDN reference is the complete documentation of this method and explains a couple other advanced calls for other less common scenarios: http://msdn2.microsoft.com/en-us/library/ms452435.aspx

     

    Post Update on 2007-10-22 to explain further an issue around the example.com placeholder.
    Post Update on 2007-10-23 to correct the ProgID in the sample htm document to use "InfoPath.Document" instead of "mso-application".

     

  • Features Available by VSTO and Office Product Combination

    This page on MSDN provide a very cool matrix of which features are available for development depnding on your mix of VSTO version and Office version.

    http://msdn2.microsoft.com/en-us/library/aa942839(VS.80).aspx

  • Hide a Date Picker Control

    Have you ever tried to hide a date picker control using conditional formatting? Well you can’t! We don’t know why this option is disabled on the conditional formatting dialog. InfoPath 2007 doesn’t fix this either. We know you still need to hide those date pickers. Here’s a trick.

    Wrap the date picker in a section control and then set the conditional formatting on that control. You have to bind the section control to something, and I recommend just binding it to the same date node itself so the relationship is clear and to avoid extra nodes in your data source / schema.

    To do this easily you need to switch to the Data Source task pane and then find the node which corresponds to your date picker control. The fastest way is to just again click on the date picker control, and the appropriate node will be selected. Then “right-drag” and drop the particular date node from the tree to your view. You will be presented with a menu of additional control insertion options. Select the “Section” control. There you have your section. Now drag and drop your date picker into that and set the conditional formatting on the section.

  • Security Error Opening a Managed Code Form

    Sometimes when trying to access an InfoPath form deployed to a web site you will get a cryptic security error preventing the form from opening. This can happen both for intranet or internet web sites and is oftentimes due to the fact that the form has C# code in it. This can happen even if the C# InfoPath project is empty. Most of the time you will see a dialog like this:

    Initially you should do the following to eliminate some typical causes for this:

    1. Clear your Internet Explorer cache by selecting Options from the Tools menu. This is to work around a bug in Internet Explorer.
    2. Delete any existing copy of the form that has been cached by InfoPath. To do this open InfoPath and in the "Fill Out a Form" dialog select the form to delete and click "Remove this form" in the right list of commands.
    3. Finally close all instances of InfoPath and Internet Explorer and then try to reopen the form.
    4. As a last resort reboot your machine to ensure that IE and InfoPath are really shut down when retrying.

    If this does not solve the problem then you can try adding the web site to your Local Intranet zone in Internet Explorer.

    Note: Be careful to only add sites which you trust to the Local Intranet zone. This zone grants greater privileges to included web pages and forms.

    Note: Managed code runs with reduced security when a site is added to the Trusted Sites zone. Yes this is counter-intuitive but that's how it works. So don't get confused and add a site to your Trusted Sites zone.

    To add the site to the Local Intranet zone in Internet Explorer do the following:

    1. In Internet Explorer select Internet Options from the Tools menu.
    2. Select the Security tab from that dialog.

    1. Select "Local intranet" then click the Sites button.
    2. In that dialog click the "Advanced..." button. You will get this dialog.

    1. In the text box at the top enter the name of the server you are trying to access. For example enter http://myintranetsite/ or http://www.example.com.
    2. Click the Add button.
    3. Click Close on this dialog.
    4. Click OK on the previous dialog.
    5. Click OK on the Internet Options dialog.
    6. Try opening the form again. Note: You may need to close all instances of Internet Explorer and InfoPath first for the change to take effect.
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.