Microsoft InfoPath 2010
The official blog of the Microsoft InfoPath team

  • Microsoft InfoPath 2010

    Download the Beta!

    • 10 Comments
    I'm super excited to announce Microsoft Office InfoPath 2007 Beta and Microsoft Office Forms Server 2007 Beta for browser-enabled forms, so you can install both of them today.
     
     
     
    After registering you'll get to select which products you want, which should include:
    • Microsoft® Office Professional Plus 2007 (includes InfoPath)
    • Microsoft® Office SharePoint® Server 2007 - Enterprise (includes Forms Services, which is also available standalone as Microsoft® Office Forms Server 2007. Both servers have 64-bit options.)
     
    All are available in English, French, Spanish, German, and Japanese, so tell your friends!
     
     
    Woohoo!
    - Ned and the whole exuberant InfoPath team
  • Microsoft InfoPath 2010

    InfoPath Trick to Localize a form in a single view

    • 4 Comments

    TRICK: Localized form in a single view

    Applies to: Microsoft Office InfoPath 2003 SP1

    Need the same form in many languages?  Here’s a trick that’s easier than multiple views.

    Summary

    By taking advantage of new SP1 features, there’s a simple way to create a multi-language view without duplicating bindings.

    I have used a secondary data source with read-only borderless fields as labels for the view.  This secondary data source is populated by an XML File Data Connection that grabs a file in the LabelsLanguage form library.  This form lib populates a drop-dom, changes of this update the aux-dom and refresh the view.

    There are 2 buttons for adding new languages and editing the current labels of the form.  These pop up a second solution.  To add a new language, just fill out the form and submit.  Look at one of the existing languages for examples.  If you see a typo in your language, feel free to correct it and save.

    To work with button labels, manually update the view using xsl:value-of elements.  Otherwise, use the workaround that I have in the screenshot.

    Known issues:

    • If you update a language on the fly, you need to force IE to always update the cache so you will get the drop-down changes.
    • Some flashing when changing the language.

    Example

    Here’s a sample of what it might look like:

    Picture with a language drop down selection 

    Form Code


    public void ChangeLanguage(DataDOMEvent e)
    {           
          if (e.IsUndoRedo) return;
          if (e.Operation.ToUpper() == "DELETE") return; //handle double notifications
     
          // Generate the new file name from the drop-down
          string strFileName = (string)e.NewValue; //from dropdown english.xml
          XMLFileAdapter2 xfaLabels = e.XDocument.DataAdapters["Labels"] as XMLFileAdapter2;
          string strCurrentUrl = xfaLabels.FileURL; //from adapter http://server/site/francais.xml
          string strBaseUrl = strCurrentUrl.Substring(0,strCurrentUrl.LastIndexOf("/")); // http://server/site
          string strCurrentFileName = strCurrentUrl.Substring(strCurrentUrl.LastIndexOf("/")); // francais.xml
          string strNewUrl = strBaseUrl + "/" + strFileName;          // http://server/site/english.xml
          xfaLabels.FileURL = strNewUrl;
     
          // the drop-down refreshes everything
          xfaLabels.Query();
          (e.XDocument.DataAdapters["Languages"] as SharepointListAdapter).Query();
    }
     
    public void AddLanguage(DocActionEvent e)
    {
          string strLanguagesFormUrl = "http://your-forms-url/template.xsn";
          thisApplication.XDocuments.NewFromSolution(strLanguagesFormUrl);
          (e.XDocument.DataAdapters["Languages"] as SharepointListAdapter).Query();
    }
     
    public void EditLabels(DocActionEvent e)
    {
          XMLFileAdapter2 xfaLabels = e.XDocument.DataAdapters["Labels"] as XMLFileAdapter2;
          thisApplication.XDocuments.Open(xfaLabels.FileURL, 1);     
    }
     
  • Microsoft InfoPath 2010

    Cool Forms! NCAA March Madness Bracket

    • 5 Comments

    This week’s cool InfoPath form is a browser form used to run a bracket tournament at Microsoft. The form uses filtered dropdowns to let users make their picks for NCAA March Madness 2010, and uses conditional formatting to show correct and incorrect picks as the tournament progresses. There’s also a printable view that shows the full bracket on one page, making it easy to print your bracket and show it off to your co-workers.

    The form contains several data connections to SharePoint lists containing participants and results, which means that updating the results is as simple as editing a SharePoint list item, and doesn’t involve changing the form at all.

    Edit View (click to see larger image):

    Edit View

    Display View (click to see larger image):

    Display View

    Print View (click to see larger image):

    Print View

    For details on how we created the filtered dropdowns in this form, see Use Rules and Filters to Create Cascading Dropdowns.

    If you have a “cool” form that you would like to share with us, please send an e-mail with the following details to coolform@microsoft.com -

    • Attach 1 or 2 screenshots of your form
    • Provide a brief description of the form
    • You may also attach the XSN file (optional)

    The most popular submissions will be featured on our blog in future posts.

    Check out other Cool Forms! here.

  • Microsoft InfoPath 2010

    Install the Office 2010 Technical Preview and win an Xbox 360 Elite!

    • 1 Comments

    We on the InfoPath team are delighted to announce the release of Microsoft InfoPath 2010 (Technical Preview). We’re really excited to share all of our great new features with you!

    (Click the thumbnails for higher-resolution images.)

    InfoPath 2010

    InfoPath Desiger 2010

    Highlights

    • Use InfoPath to customize SharePoint list forms
    • Design forms more quickly and easily with page and section layouts, themes, and Fluent user interface.
    • Add smarts to your forms with pre-built rules
    • Publish your forms with one-click

    Where do I sign up?
    The Office 2010 Technical Preview is a limited-availability release.  To sign up to be considered for the Office 2010 Technical Preview program:

    How do I win the Xbox? 

    • Build a real-world end to end application using InfoPath 2010 and Microsoft SharePoint Server 2010.
    • Download the Community Clips Recorder from http://communityclips.officelabs.com/ 
    • Record a walkthrough of your solution, showing us how you used InfoPath forms and other Office technologies (5 minutes maximum)
    • Submit the finished video to us

    Contest is limited to eligible members of the InfoPath 2010 Technical Preview program referenced above, and additional limitations may apply.  All submissions will be reviewed by the InfoPath team, and prizes will be awarded in several categories, including best overall solution, best video, and best bug.  Contest details will be posted on the technical preview site at http://connect.microsoft.com.

    We will post more details on our new features in the coming weeks. Stay tuned!

  • Microsoft InfoPath 2010

    Using the Events Manager of the InfoPath Hosted Control

    • 6 Comments

    The InfoPath hosted control gives developers of third party hosted applications the ability to respond to events in the form.  The InfoPath event manager provides this functionality.  Through the event manager a host application can respond to 5 form events, 3 xml events and 1 control event:

    Form Events

    Xml Events

    Control Events

    Saving event
    Context Changed event
    Sign event
    Merging event
    View Switched event

    Changing event
    Validating event
    Changed event

    Clicking event

    How can third party host applications use the event manager?

    Step 1: Implement an InternalStartup method

    First, add code to handle the InternalStartup event. InternalStartup method will execute when a form loads.

    public Form1()
    {
                InitializeComponent();
    
                //sync to the startup event where you can register for individual events
                formControl1.InternalStartup += new Microsoft.Office.InfoPath.FormControl.EventHandler<EventArgs>(InternalStartup);
    }

    Next, implement your InternalStartup method. The function signature should look similar to:

    void formControl1_InternalStartup(object sender, EventArgs e)

     

    Step 2: Register to receive events

    In your InternalStartup method add code to register for events. For form events this code looks like this.

    void InternalStartup(object sender, EventArgs e)
    {           
           ((FormControl)sender).EventManager.FormEvents.ViewSwitched += new ViewSwitchedEventHandler(OnSwitchView);
           ((FormControl)sender).EventManager.FormEvents.Submit       += new SubmitEventHandler(OnSubmit);
           ((FormControl)sender).EventManager.FormEvents.Sign         += new SignEventHandler(OnSign);
           ((FormControl)sender).EventManager.FormEvents.Save         += new SaveEventHandler(OnSave);
           ((FormControl)sender).EventManager.FormEvents.Merge        += new MergeEventHandler(OnMerge);
     }

    For xml events you must provide the XPath of the node whose events you wish to respond to. Below is a sample of how to register to receive xml events.

     

    void InternalStartup(object sender, EventArgs e)
    {
          ((FormControl)sender).EventManager.XmlEvents["/my:myFields/my:field1"].Changed    += new XmlChangedEventHandler(FieldChanged);
          ((FormControl)sender).EventManager.XmlEvents["/my:myFields/my:field1"].Changing   += new XmlChangingEventHandler(FieldChanging);
          ((FormControl)sender).EventManager.XmlEvents["/my:myFields/my:field1"].Validating += new XmlValidatingEventHandler(FieldValidating);
    }

    To receive the click event for a button you must specify the control id of the button. Below is a sample of how to register to receive control events.

    void InternalStartup(object sender, EventArgs e)
    {
          ((ButtonEvent)((FormControl)sender).EventManager.ControlEvents["CTRL2_5"]).Clicked += new ClickedEventHandler(ButtonClicked);
    }
    

     

    Step 3: Implement methods to handle each event registered

    The final step is to implement handlers for the events you have registered for.
    The handlers for the events have the following method signatures.

    Form Events

    public delegate void ViewSwitchedEventHandler(object sender, Microsoft.Office.InfoPath.ViewSwitchedEventArgs e)
    public delegate void SubmitEventHandler(object sender, Microsoft.Office.InfoPath.SubmitEventArgs e)
    public delegate void SignEventHandler(object sender, Microsoft.Office.InfoPath.SignEventArgs e)
    public delegate void SaveEventHandler(object sender, Microsoft.Office.InfoPath.SaveEventArgs e)
    public delegate void MergeEventHandler(object sender, Microsoft.Office.InfoPath.MergeEventArgs e)

    Xml Events

    public delegate void XmlChangedEventHandler(object sender, Microsoft.Office.InfoPath.XmlEventArgs e)
    public delegate void XmlChangingEventHandler(object sender, Microsoft.Office.InfoPath.XmlChangingEventArgs e)
    public delegate void XmlValidatingEventHandler(object sender, Microsoft.Office.InfoPath.XmlValidatingEventArgs e)
    

    Control Events

    public delegate void ClickedEventHandler(object sender, Microsoft.Office.InfoPath.ClickedEventArgs e)

    Example: changed event, view switched event, button clicked event.

    void FieldChanged(object sender, XmlEventArgs e) {}
    void OnSwitchView(object sender, ViewSwitchedEventArgs e) {}
    void button1_Click(object sender, EventArgs e) {}

     

    Things to know about handling events

    1. Events are handled first by the form’s business logic, then by others who register to handle events. Since events are handled asynchronously it is possible that the code in the business logic may cancel the event, and deny the host the opportunity to handle the event.
    2. In order to handle the submit, save and merging events, the designer of the form template must specify that the event is to be handled through the use of code. Without enabling this in the form template the event will not be handled in code.
    3. Buttons must specify that clicks be handled through code or the event will not be handled through code.
    4. The sign event will only take place when the form is fully trusted.
    5. The Loading and VersionUpgrade events are not available from third party hosted applications as these events occur before the form is loaded in the hosted application.

    DeVere Dyett
    Software Design Engineer in Test

  • Microsoft InfoPath 2010

    Implementing Change Tracking for InfoPath Forms

    • 1 Comments

    Although InfoPath doesn't have a Change Tracking feature built-in like Word and some of the other Office System applications, read on for guidance on how to implement it in your own solutions.

    There are several problems to decide before jumping into implementation: where do you want to store change tracking information, how do you map between list of changes and elements, tracking information protection, and what format you use to store change tracking information.

    Storage options

    Depending on schema of XML there are several options:

    1.  Closed schema - public or required by third party.
      1. "Envelope" approach - you can store whole document as XML sub tree inside your own XML with open schema.
      2. Using Processing Instructions to store data is possible when the schema allows it and consumers of XML can handle processing instructions correctly. Note that even if one suppose to ignore them it is not always the case.
      3. Separate file. Just keep tracking information somewhere (I.e. local file or remote Web service). This approach is remotely reasonable if you know how to associate data with tracking information.
    2. Open schema
      • Store tracking information as single attribute.
      • Store tracking information as sub-tree of each element that is interesting for change tracking
      • Store tracking information in single node providing some mapping between elements you are interested in and tracking information.

    Format options

     1. XML friendly.

    If you want your tracking information to be processed using some form of normal XML handling (XSL, XML readers, XPath navigation) then you should use XML sub-trees to store change tracking information.

    For example:

     <changes>
      <change forElement="element1233" date="2004-06-12" author="john" type="textChange">New text</change>
      <change forElement="element1233" date="2004-06-14" author="fred" type="textChange">Don't writen new text!</change>
     </changes>

     2. Custom text format

     If you can't use normal XML for some reasons (i.e. storage options 1.b, 2.a) then you can develop text format to store the data. You can use approach close to XML (i.e. just store sub-tree as string) or even go with Base64 encoded binary.

    Mapping between element and tracking information

     1. Direct access.

     If you can put tracing information right into element you are interested in then you don't need any mapping.

     Note that this approach requires you to think through deletion scenario because the element itself might be deleted along with it's tracking information.

     2. Element ID. 

    This is an easy option to implement if you have or can establish persistent unique element identifiers for each element you want to track changes. It could be attribute on elements or some combination of attributes and values of element.

    Note that you can not use XPath to element as unique id if you have any repeating content you want to track changes on.

    The problem here is that you need to have good ID and should think through insertion of elements.

    3. Position based mapping.

    This is the most complex option to implement. If you can't have any identifiers for element you had to go with position based mapping. I.e. 

    <change forElement="/root/items[0]/item[4]/component[3]" date="2004-06-12" author="john" type="textChange">New text</change>

    where forElement contains the XPath to the element of interest.

    The main problem here is that you have to dynamically update all mappings on element insertions through the tree.

    Change tracking information protection

    You should consider if and how you want to protect this data. Approaches would vary from digitally signing each change (or editing session) to "who cares if it is changed?"

    Coding ideas for simplest case

    You have unique element IDs that somehow get generated for elements. You are interested in recording changes in text value of an element.

    Here is sample of XML you want to record changes for:

    <root>
     <items>
      <item id = "12"><textToTrack>text</textToTrack></item>
      <item id = "23"><textToTrack>text</textToTrack></item>
      <item id = "55"><textToTrack>text</textToTrack></item>
     </items>
    </root>

    The approach choosen to store the data: separate from the data as subtree of the <root> node, and no protection and tamper detection for tracking information.

    Here is example of XML with tracking information.

    <root>
     <changes>
      <change forElement="12" date="2004-06-12" author="john" type="textChange" ><old>text</old><new>Shining new text</new></change>
      <change forElement="12" date="2004-06-14" author="fred" type="textChange" ><old>Shining new text</old><new>Don't write new text!</new></change>
      <change forElement="23" date="2004-06-14" author="fred" type="delete"></change>
     </changes>
     <items>
      <item id="12"><textToTrack>Don't write new text!</textToTrack></item>
      <item id="55"><textToTrack>text</textToTrack></item>
     </items>
    </root>

    To code this in InfoPath you need:

    Make sure schema allows <changes> to be inserted. I.e. In designer for new solution create this structure in the Data Source task pane.

    Figure out how to get user name if needed.

    Add an "OnAfterChange" listener for <items> node, and implement the following pseudo-code:

     IF change = "add" AND node-name = "item"
      make sure ID is generated for "add"
      record (ID, added) information.
     IF change = "remove" AND node-name = "item"
      record  (ID, deleted)
     IF (change = "add OR change = "remove" OR change = "change") AND node-name = "textToTrack"
      record (ID, textChange, oldValue, newValue)
      

    Where ID is "id" attribute of corresponding "item" node, and record means append all needed information a <changes> collection. Record function should also take care of merging change information for the same date/user like if node was added in this session all changes should be combined into "added" record, rather then creating multiple "changed" sections.

    Note that "undo" user actions will rollback change as well as tracking information. If you store data in separate file you should take care of undo yourself.

     

  • Microsoft InfoPath 2010

    Example script for showing Mail Envelope based on User’s Role

    • 1 Comments

    The option to “Submit as Email” doesn’t include the form in the body of the mail, so here’s another way to encourage your form-fillers to send their forms as email and include that body.

    This script could be used in a Blogger form to turn on the Mail Envelope when the user switches to the “Email” view. That event could be triggered by the form-filler using the View menu, or even by a Rule on a button. It also makes some decisions based on the user’s current role so you can see how to do that.

     

    function XDocument::OnSwitchView(eventObj) {

      var mail = XDocument.View.Window.MailEnvelope;

     

      if (XDocument.View.Name == "Email") {

        // get nodes from DOM

        var blog = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:blog");

       

        var id       = blog.selectSingleNode("@ID");

        var title    = blog.selectSingleNode("@Title");

        var blogger  = blog.selectSingleNode("@BloggerName");

        var replies  = blog.selectNodes("d:reply/@ReplyName");

     

        // Set To field to include blog and the original blogger

        mail.To = "blog; " + blogger.text;

     

        // Set CC field to include all the replies (minus the current one)

        if (replies != null) {

          var cc = "";

          for (var i = 0; i < replies.length - 1; i++) {

            cc += replies(i).text + "; ";

          }

          mail.CC = cc;

        }

     

        // Set subject to look like a thread

        var subject = "Blog " + id.text + " - " + title.text;

        if (XDocument.Role != "Create")

          subject = "RE: " + subject;

        mail.Subject = subject;

     

        // Show the mail envelope

        mail.Visible = true;

      }

      else {

          mail.Visible = false;

      }

     

     

  • Microsoft InfoPath 2010

    Create Code-Free Mashups with InfoPath and SharePoint Web Parts

    • 3 Comments

    Hi, My name is Nicholas Lovell and I’m a developer on the InfoPath team. In this video demo, I will walk through how to create a simple portal page for processing claims at an insurance company. This claims portal includes a SharePoint Web Part with a list of all the claims, an InfoPath Web Part that displays the claim details, and a custom Bing Maps Web part which displays the location of the currently selected claim.

    Get Microsoft Silverlight

    Enjoy and please share your comments with us!

    Nick

  • Microsoft InfoPath 2010

    InfoPath Quick Tip: Setting a User Role as the Initiator

    • 3 Comments

    In Microsoft Office InfoPath 2003, you can assign users to distinct categories, called user roles, which are based on job title or other criterion. InfoPath can perform custom actions that vary based on the current user role, such as switching views, conditional formatting, data validation, or filter settings.

    Some InfoPath form designers have found the Set as initiator option for user roles to be somewhat confusing when specifying a role using network accounts. (The Set as initiator option is available when defining a user role by clicking User Roles on the Tools menu, and then clicking Add). Setting a user role as the initiator will cause InfoPath to use that role whenever a new blank form is opened for the first time regardless of how the user is logged on to the network. However, the next time that user opens the same form, InfoPath will use the person's assigned user role instead of the initiator role

    For example, suppose you create a form template with an Employee View and a Manager View and then create a rule to switch views based on whether the current user role is Employee or Manager as demonstrated in Lab 7: User Roles in InfoPath 2003. Because the Employee role is set as the initiator, when a user creates new blank form, InfoPath will always set the user role to Employee even if the current user is not a member of the network group or user accounts specified for the Employee user role. As a result, InfoPath will always switch to the Employee View the first time a user creates a new blank form. Only after the form is saved and re-opened will the rule be applied based on the user role defined for the user's network account.

  • Microsoft InfoPath 2010

    Protecting Sensitive Data

    • 9 Comments
    Frequently, we find developers using InfoPath as a platform for developing solutions that manipulate sensitive data, may it be financial data, patient records, or performance review forms. This article shares tips on protecting such data.
     
    First and foremost, you must know that an InfoPath form is a plain-text XML file. A malicious user can read it through Notepad or other text editor, circumventing any InfoPath authentication logic. So if a user has read access to an InfoPath XML form, anything stored in that XML file can be read. Information Rights Management in InfoPath 2007 allows storing encrypted XML; we'll talk more about it below.
     
    Also remember that an InfoPath form template (.xsn file) is just a CAB archive, containing plain-text files. These files store all client-side form logic. Information Rights Management allows you to encrypt form templates in InfoPath 2007, see more about it below.
     
    Like with any other client-server application development platform, you can never trust the logic that happens on the client. InfoPath uses the form template to store all form logic; if the user has access to the form template (and they must in order to be able to open any form based on that form template), they can create a hacked version of the template, circumventing any restrictions that the original form author put in place.
     
    This means that authentication and authorization performed on the client can't be trusted; calculations and data validation have to be re-done on the server. Here is an example of how this strategy can be realized for a simple record-keeping application:
     
    • Do not store sensitive data in the XML file; instead, store keys in the XML file, and perform queries on load that populate the rest of the data by using a database/web service. If the user is unauthorized (as determined by the server-side logic), return an empty dataset. You can even detect such condition on the client and show a friendly error message.
    • On submit, send the data to a web service and redo all non-schema validations on the server side. For example, if employees should not be able to submit expense reports above $100 without specifying an approver, have your web service process the dataset and verify that this condition is satisfied. 
     
    It is always a good idea to restrict access to a production form template by assigning read-only permissions to form users, write access to form maintenance staff, and no access to everyone else. This can be done by using permission features of the SharePoint Server or file shares. Even if you install form templates to the users' machines via a logon script, you can still control access to the .xsn file - provided the user is not running as an administrator, you can set their access to the template file to read-only.
     
    You may want to enable the protection feature for production form templates:
     
     
    However, remember that this protection feature is for recommendations only, it is not intended as a security mechanism. This will show the user a nice error message if they accidentally try to open the template in the Design mode, but won't defend the form template against a malicious user.
     
    Information Rights Management, or IRM, is a new feature for InfoPath 2007; some of you may already be familiar with the concepts from the other apps in the Office 2003 release. IRM allows the form author to protect both the form template and forms based on the template; IRM infrastructure must be in place in the organization to make this possible. Briefly, IRM is a way to encrypt both form templates and forms, allowing form author to specify who can access the template and suggest default rights for forms based on the template:
     
     
    Note that IRM is an InfoPath client-only feature, and it will not work in browser-enabled form templates.
     
    Alex Weinstein
    Program Manager
  • Microsoft InfoPath 2010

    Designing browser-enabled forms for performance in InfoPath Forms Services (Part 5)

    • 2 Comments

    Part 5 – Addendum: Counters for monitoring form server performance


    Welcome to the fifth article in our series on optimizing the performance of InfoPath browser-enabled forms. In our previous articles we defined performance in terms of responsiveness, listed a number of conditions that cause postbacks, and looked at some of conditions that make postbacks more expensive, reducing the responsiveness and scalability of a form system. We also described some of the issues that affect form-rendering performance in the browser and suggested using the Design Checker to monitor browser compatibility issues while designing a form template in the InfoPath Designer.

    In this addendum article, we list some useful performance counters you can use in the Windows Performance Monitor (PerfMon) to monitor the behavior of your form server system. Using a combination of general system counters and InfoPath-specific counters to monitor the performance of your servers can help you troubleshoot issues and quantify the performance effects of changes you make to the design of your InfoPath form templates.


    System counters for monitoring your form server system

    There are two key places where performance bottlenecks can occur in your form server system, on your Web front end (WFE) servers and on your SQL Server back end. The bottlenecks that occur on the front end are normally CPU bound, while the bottlenecks at the SQL Server back end are normally either disk bound or CPU bound.

    You can use the following system counters in PerfMon to check the performance of your WFE and SQL Server systems under various load conditions. Use these counters to determine whether your servers are performing at acceptable levels and to help identify any bottlenecks.


    Counters for monitoring a WFE server system

    • CPU:
      Processor\% Processor Time\_Total
      Indicates the total CPU load on the server.

    • ASP.NET:
      ASP.NET \Requests Queued
      A linear increase of this counter with user load can indicate that an application is experiencing a bottleneck, either at the front end or the back end. Correlate with other ASP.NET counters, SQL counters, and WFE CPU counter to understand which part of the system is getting bottlenecked.

      ASP.NET\Requests Execution Time
      Use this counter to find which type of form template takes more time to execute in the server. In general, forms with managed code require more execution time than forms that don’t. If this counter and WFE CPU counter are high while the SQL transactions/second counter and SQL CPU counter are low, then the bottleneck is at the WFE side. This may be an indication that the form complexity is high or that the form has a lot of managed code.

    • Memory:
      No. of current logical threads
      If the count is increasing, then the thread stacks are leaking.

      Private bytes and No. of bytes in all heaps
      If the count of private bytes is increasing while the number of bytes in all heap counter is stable, then the unmanaged memory is leaking.
      If the count of private bytes is increasing and the number of bytes in all heap counter is also increasing, then the managed heap is building up.


    Counters for monitoring a SQL Server system

    • CPU:
      Processor\% Processor Time\_Total
      Values above 25% indicate a possible bottleneck. Values above 80% signify extreme CPU-bound SQL operations. A linear increase in CPU with user load indicates that SQL will become a bottleneck.

    • Disk:
      PhysicalDisk\Avg.DiskQueueLength\{Disk_with_SQL_DB}
      Counter should be less than 1.5 or 2 times the number of RAID disks. Correlate with % Disk time counter and Current Disk Queue counter to determine whether the disk is a bottleneck. Decrease your test load to see if the values go down.

      SQLServer:Locks\Number of Deadlocks/sec\_Total
      Value should be zero.

    • Memory:
      Pages/sec
      Non-zero value for a sustained period of time indicates that the system is experiencing a high memory load. SQL Server works best when the operating system does not reallocate its memory.


    Counters provided by the InfoPath Forms Services performance object

    InfoPath Forms Services installs a set of counters that can be viewed in PerfMon. There four types of counters provided by the InfoPath Forms Services performance object: Transaction, Session, Data Connection, and Template/Document.

    • Transaction counters represent all communication between the browser and the server. You can use the transaction counters to monitor how long postbacks are taking to complete and as a gauge for how expensive they are for the server to process.

      Avg. Transaction Duration
      The average time to complete a transaction in form-filling sessions.

      Transactions Started Rate
      The rate at which transactions started in form-filling sessions.

      Transactions Completed Rate
      The rate at which transactions completed in form-filling sessions.

    • Session counters provide duration and rate information for user form-filling sessions. If there are too many active sessions for the server to handle, you will see excessive average durations that indicate a server bottleneck.

      Avg. Session Duration
      The average time to complete a form-filling session, summed up over all transactions in the form-filling session.

      Sessions Started Rate
      The rate at which form-filling sessions started.

      Sessions Completed Rate
      The rate at which form-filling sessions completed.

    • Data Connection counters show the duration and rate of both data connection submit and query activities, along with failures. This will give you an indication of back end performance and how long data connections are taking to complete.

      Avg. Data Connection Submit Duration
      The average time to complete a data connection submit in form-filling sessions.

      Data Connection Submit Started Rate
      The rate at which data connection submits started in form-filling sessions.

      Data Connection Submit Completed Rate
      The rate at which data connection submits completed in form-filling sessions.

      Data Connection Submit Failure Rate
      The rate of failures for data connection submits in form-filling sessions.

      Avg. Data Connection Query Duration
      The average time to complete a data connection query in form-filling sessions.

      Data Connection Query Started Rate
      The rate at which data connection queries started in form-filling sessions.

      Data Connection Query Completed Rate
      The rate at which data connection queries completed in form-filling sessions.

      Data Connection Query Failure Rate
      The rate of failures for data connection queries in form-filling sessions.

    • Template/Document counters give information about the number of forms and form templates that are currently in the ASP.Net cache and in memory. These can help you monitor and detect memory utilization issues on your server.

      # of Cached Form Templates
      The number of form templates that have been added to, and not yet expired out of, the ASP.NET object cache.

      # of Business Logic Assemblies in Memory
      The number of business logic assemblies currently loaded in memory. Administrator-approved form templates may contain zero, one, or more managed code assemblies.

      # of Form Templates in Memory
      The number of form template objects that are currently loaded in memory.

      # of Cached Form Templates in Memory
      The number of forms that are currently loaded in memory.


    Server system health monitoring

    The general system counters and InfoPath Forms Services counters listed above are useful for monitoring specific issues on a server, but do not provide comprehensive health monitoring for your overall form server system. For that you need to use a solution designed to watch multiple servers for issues that may cause service or performance degradation, such as Microsoft System Center Operations Manager 2007. Operations Manager uses management packs that contain predefined rules, settings, and agents to monitor a specific service or application. For SharePoint, you can download the SharePoint Monitoring Toolkit, which contains the management packs and documentation for both Windows SharePoint Services 3.0 and Microsoft Office SharePoint Server 2007. Note that System Center Operations Manager also provides the capability to customize existing rules or create your own rules.

    For more information about the SharePoint management packs for Operations Manager 2007, see the SharePoint Monitoring Toolkit Executive Overview (http://technet.microsoft.com/en-us/library/bb975149.aspx).

    For more information about Microsoft System Center Operations Manager 2007, see the System Center Operations Manager TechCenter (http://technet.microsoft.com/en-us/opsmgr/default.aspx).

     

  • Microsoft InfoPath 2010

    More than one way to write code: Visual Studio and InfoPath

    • 3 Comments
    If you need to write some Visual Basic or C# code behind your form, or maybe just some script, there are a few different tools you can use depending on which versions of InfoPath and Visual Studio you have.
     
    Here's a quick table summarizing it all:
     
     
    Note that both Microsoft Script Editor (MSE) and Visual Studio Tools for Applications (VSTA) come with InfoPath 2007 Beta, so you can open them from the Tools | Programming menu. If you don't see the one you want, change the language in Tools | Form Options. If it gives you an error that it's not installed, here's how to install them:
     
    1. If you are going to install VSTA, make sure you have the pre-requisites first:
    2. Go to Start > Control Panel > Add or Remove Programs
    3. Select your Office installation and click Change
    4. In the Office Setup wizard select to add features
    5. Find Microsoft Script Editor (under Office Tools) and/or Visual Studio Tools for Applications (under InfoPath > .NET Programmability) and select Run from my computer
    6. Finish the wizard
     
    Happy code writing!
    - Ned
  • Microsoft InfoPath 2010

    Help Us Improve InfoPath: Send Us Your Forms!

    • 11 Comments

    The Microsoft Office InfoPath Team is interested in seeing how you are using InfoPath.  We would like you to send us your InfoPath forms so we can review them and collect data on how you are using the forms.  We will be using these forms to implement improvements in future versions of Microsoft Office InfoPath. We are interested in looking at a variety of forms ranging from simple to complex (in terms of length, rules, data connections, code, etc.).

    Please send us your forms at ipforms@microsoft.com and include a brief description of how the form is used, what is working well for you and any suggestions for improvement. Also let us know if we can contact you with any follow up questions.

    We cannot guarantee that every form will be reviewed or that the confidentiality of the forms or information contained therein will be maintained.  We ask that you not submit forms containing confidential information.
     
    Thank you for your submissions.  We look forward to hearing from you.
    Microsoft Office InfoPath Team

  • Microsoft InfoPath 2010

    What button was clicked?

    • 3 Comments

    Another question that we get asked a lot:

    I include a Repeating Section control in my form, containing a Button and a Text Box. At runtime, a user inserts 5 items. How do I know which Button was clicked so I can get to the Text Box’s value?

    That’s actually the wrong question to ask. Strictly speaking, InfoPath doesn’t know the difference between the Buttons. They are all identical clones. What’s different about each button is its context within the view, and the view is mapped to the data. (In InfoPath it always comes back to the data.)

    If your schema looks like this:

    • myNodes
      • group1
        • group2 (repeating)
          • field1

    Your view probably looks something this:

    [View Structure]

    Since the Button control is inside the Repeating Section which is bound to group2, we say that the Button’s context is group2.

    So what?

    When the Button event is received, it contains a DocActionEvent object. The event object has a Source property. And this property is the Button’s context node – the specific group2 instance the Button is inside.

    So at this point, you can just use eventObj.Source to refer to data relative to the Button. Probably the easiest thing to do is just do some old school debugging using alerts. Here’s how to make sure you’re getting the context right:

    function CTRL3_5::OnClick(eventObj)

    {

    // Write your code here

    XDocument.UI.Alert( eventObj.Source.xml );

    }

    Here’s what you’d get:

        <my:group2 xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2004-09-14T16:02:14">

            <my:field1>abc</my:field1>

        </my:group2>

    And to wrap things up, to get the text inside the Text Box, you need to use eventObj.Source.selectSingleNode():

    function CTRL3_5::OnClick(eventObj)

    {

    // Write your code here

    XDocument.UI.Alert( eventObj.Source.selectSingleNode("my:field1").text );

    }

  • Microsoft InfoPath 2010

    InfoPath 2010: Menu to ribbon reference workbook

    • 1 Comments

    Find the new locations of InfoPath 2007 commands in InfoPath 2010. The InfoPath 2010 menu to ribbon reference workbook contains tables that list the old menu commands and show where in InfoPath 2010 those commands are located.

    This Excel workbook is now available to download from http://office2010.microsoft.com/en-us/templates/CL101817133.aspx.

  • Microsoft InfoPath 2010

    Converting a Data Source

    • 3 Comments

    For anyone who has developed an InfoPath form template against a schema, database, or Web service that has changed since the form template was initially created, the following should be some good news.  The SP1 Preview Release of InfoPath contains the ability to provide InfoPath with an updated version of your schema or data source and InfoPath will update your solution accordingly.  That’s right, gone are the days of hand modifying the XSF, template file, XSL, etc. in order to change the schema.  You can change your main data source via the ToolsàConvert Main Data Source menu entry or a data connection via the modify button for that source in the ToolsàData Connection dialog.

    When you provide InfoPath the updated data source, InfoPath will update the schema files stored in the form template and look for and apply changes between the old and new data source.  In particular InfoPath will look for type changes, cardinality changes, namespace changes, adds, deletes, renames, and move operations.  For any recognized operation, all existing bindings in the view, XSF, and event handler hookup will be fixed accordingly (note, it is still your responsibility to fix business logic code.)  Unfortunately InfoPath is not omnipotent, so it might not be the best idea to wait until you have renamed, moved, and extremely modified the children of an element before providing the updated schema to InfoPath ;-)

    (And if a menu option to update your data source isn't convenient enough, tomorrow we'll start a five part series on the InfoPath Team Blog showing you how you can automate this sort of operation by taking advantage of InfoPath's XML-based form template file format.) 

  • Microsoft InfoPath 2010

    Modifying InfoPath manifest.xsf file from script (3/5)

    • 1 Comments

    Part 3 of 5: Modifying the XSF

     

    Because manifest.xsf file is just a plain xml file, the easiest way to modify it is to open it in an XML DOM, find the corresponding attributes with XPath, and replace their existing values with new data.

     

    We will divide the process in two functions. The first one will be responsible for opening and saving the xml file. The second one will find and modify the attribute value.

     

    The serviceURL and wsdlURL parameters are strings with values like “http://mywebservice” and “http://mywebservice?WSDL” accordingly.

     

    var XsfNamespace =

    "http://schemas.microsoft.com/office/infopath/2003/solutionDefinition";

    var XpathToServiceUrl =

    "//xsf:webServiceAdapter/xsf:operation/@serviceUrl";

    var XpathToWsdlUrl =

    "//xsf:webServiceAdapter/@wsdlUrl";

     

    function FixupXSF(xsfInputPath, xsfOutputPath, serviceURL, wsdlURL)

    {

          var Fso = new ActiveXObject ("Scripting.FileSystemObject");

          var Dom = new ActiveXObject("msxml2.domdocument.5.0");

     

          Dom.async=false;

          Dom.validateOnParse=false; // for ignoring xsi:nil errors..

          Dom.load(xsfInputPath);

          Dom.setProperty("SelectionNamespaces",

                      "xmlns:xsf='" + XsfNamespace + "'");

     

          // serviceURL

          if(serviceURL != null)

          {

                ModifyAttribute(Dom, XpathToServiceUrl, serviceURL);

          }

     

          // wsdlURL

          if(wsdlURL != null)

          {

                ModifyAttribute(Dom, XpathToWsdlUrl, wsdlURL);

          }

     

          if (Fso.FileExists(xsfOutputPath))

                Fso.DeleteFile(xsfOutputPath, true);     

          Dom.save(xsfOutputPath);

    }

     

    function ModifyAttribute(dom, xpath, value)

    {

          var AttributeList = dom.selectNodes(xpath);

          for (;;)

          {

                var Attribute = AttributeList.nextNode();

                if(Attribute == null)

                      break;

                Attribute.nodeValue = value; 

          }

    }

     

    The XSF file was modified. Now we should restore our XSN and we will do it in the next part of the series.

     

  • Microsoft InfoPath 2010

    Understanding the InfoPath SP1 Deployment and Security Model – An Introduction

    • 3 Comments

    A common question that was asked when people started using the initial InfoPath release was, “How can I distribute a form template to other people through email?”  In InfoPath V1, this was difficult because once you saved or published a form template to a location, it was ‘sited’ to that location.  If it was moved from that location, it would not open in the InfoPath Editor. 

    In the InfoPath Service Pack 1 release, it is now possible for form templates to be opened from locations other than their published location.  There is also a ‘Send Form as Attachment’ option under the File menu which attaches your form template to an Outlook mail message for distribution.  However, for security reasons, there are still limitations on what kinds of form templates can be opened and from what locations.  The following is a guide to understanding the InfoPath SP1 Deployment and Security Model:

    Form Template Security Level

    Each Form Template made in InfoPath SP1 has one of three security levels specified; Restricted, Domain, or Full Trust.  This setting is determined automatically by default, but can be set manually, if desired. 

    NOTE:  To access this setting in the Designer, navigate to Tools | Form Options à Security Tab. 

    Restricted – The form template does not allow any access outside of the form  

    Domain – The form template allows access outside of the form, but only within the domain of the form template

    Full Trust – The form template can access files and settings on the local computer

    The Full Trust security level can only be set manually by the user for installed templates or certificate-signed templates.  The maximum trust level that can be set automatically by InfoPath is Domain.

    All new blank form templates (except for Managed Code solutions) start out at the Restricted security level.  As you build the form, adding any of the following will automatically raise the security level to Domain:

    • Task Pane
    • Script
    • ADO Query or Submit Adapter
    • Web Service Query or Submit Adapter
    • SharePoint Query or Submit Adapter
    • Query to linked XML file
    • HTTP Submit
    • ActiveX Control
    • Roles
    • DLL Resource File
    • HWS
    • Rule that opens a new document 

    Opening the Form Templates in the InfoPath SP1 Editor

    The reason to make a distinction between Restricted and Domain security was to allow for form templates without script or data connections to be opened from anywhere.  Therefore, email deployment of restricted form templates in SP1 is easy, just send out the form template and it can be opened either from the Outlook mail itself or from wherever the recipient saves it. 

    With Domain form templates, some of the same security restrictions from v1 still exist, but SP1 allows for some added functionality.  Domain form templates still require that they be opened from their published location.  However, by using the Send Form as Attachment option in the file menu, a Domain form template can be mailed out as an attachment.  This attachment, when received and opened, functions as a link to the actual published location.  The form template at that publish location is what actually gets opened in the InfoPath Editor, not the one that was clicked on.  At that point as well, the published form template is copied locally and will appear as a selection in the Fill Out a Form dialog every time you launch InfoPath.

    Future Considerations

    This posting is meant as an introduction and does not cover all aspects of Deployment and Security.  If there are any specific questions, please respond via feedback to this article and I will follow up with further entries that will address more specific functionalities and scenarios.

  • Microsoft InfoPath 2010

    Cool video on InfoPath in Outlook

    • 5 Comments
    As part of getting everyone up to speed on Office 2007, and in preparation for the imminent release of the Beta, we've just posted some "Partner technical readiness training" videos.
     
    It includes a great one on using InfoPath in Outlook, so I thought I'd call it out:
     
    You can check out all the videos here:
     
    Enjoy!
    -ned
  • Microsoft InfoPath 2010

    Cool Forms! Team Signoff Form

    • 2 Comments

    This week’s cool InfoPath form is a simple form that we’re using for each team in Office to sign off that Office 2010 is ready to ship. One of the neat things about this form is that it makes the signoff process a visual experience by using conditional formatting to show and hide pictures based on the status.

    Signoff 1

    The form also contains rules to enforce that final signoff can only happen once both bug and testing signoffs have been completed.Signoff 2

    If you have a “cool” form that you would like to share with us, please send an e-mail with the following details to coolform@microsoft.com -

    • Attach 1 or 2 screenshots of your form
    • Provide a brief description of the form
    • You may also attach the XSN file (optional)

    The most popular submissions will be featured on our blog in future posts.

    Check out other Cool Forms! here.

    Thanks!

    The InfoPath Team

  • Microsoft InfoPath 2010

    Modifying InfoPath manifest.xsf file from script (2/5)

    • 3 Comments

    Part 2 of 5: Unpacking the XSN

    To unpack XSN one should use extract.exe utility. It can be found in the %SystemRoot%\system32 directory or in the Microsoft Cabinet Software Development Kit. For the command usage details just run “extract /?”.

    In this part we will also introduce several auxiliary functions that will be extensively used throughout the entire discussion topic.

    var ExtractExeLocation = "%SystemRoot%\\SYSTEM32";

    var ExtractExe = Combine(ExtractExeLocation, "extract.exe");

     

    function Combine(dir, file)

    {

          return dir + "\\" + file ;

    }

     

    function QuoteStr(string)

    {

          return ("\"" + string + "\"");

    }

     

    function Exec(string, flagWait)

    {

          if (flagWait == null)

                flagWait = true;

          var WScriptShell = WScript.CreateObject("WScript.Shell");

          return WScriptShell.Run(string, 0, flagWait);

    }

     

    function ExtractFilesFromXSN(xsnInputPath, outputDirectory)

    {

          var Parameters;

     

          // add the location to place extracted files,

          // a flag "/Y" that prevents prompting before overwriting

          // an existing file, and a flag "/E" that orders to

          // extract all files

          if (outputDirectory != null)

                Parameters = " /Y /E /L " + QuoteStr(outputDirectory);

     

          Exec(QuoteStr(ExtractExe)

                + Parameters

                + " " + QuoteStr(xsnInputPath), true);

    } 

    Now we have a tool to unpack XSN. All of the InfoPath form template files are accessible for changing. In the next part of the series we will be modifying the manifest itself.

  • Microsoft InfoPath 2010

    SQL Server 2005, Part III: Magic of Structured Search

    • 1 Comments

    You were patient enough to read through my ramblings about why Yukon and InfoPath are a match made in heaven, and how to set up basic interop. But these two articles left you dreaming of more. Well, that was their purpose :-).

    Magic begins: Structure-aware query. Full text search is, ahem, much less powerful.

    Just imagine: you built your resume system. HR folks can search the records by the first and last name of the candidate. Useful, but far from magical. HR comes to you and says: "hey, we want to search by years of experience!"; next day, the way to search by job title, then, they want to see candidates with EA experience...

    Query parameters keep coming every week. You're getting sick of modifying the system; maintenance costs are growing. Programming the system is no longer fun.

    Well, that was yesterday.

    Today, with Yukon, you can build dynamic queries for your customers on the fly: this involves writing an XPath expression or two. In the next few steps, we'll assume that you have the basic setup completed (if not yet, follow this article).

     

    Start with the goal

    Here's what we're trying to build:

    Works like this: pick the property you want to search (the list is dynamic); select a value that you want to search that property for; then click Run Query. This performs a few calculations, then calls a web service, and shows the result set. Then, the user can drill down on each record using the Details button.

    Why? Where's the magic? HR comes and says "I want another query criteria", and you deliver it by authoring one line of XPath in an InfoPath form. No form template modifications, no web service modifications, no C# to write.

    Here's what the end goal looks like at design time:

    Going through the building blocks:

    1) fieldToSearch dropdown: this is the core of the magic. Here you specify key-value pairs for "what XPath you want searched vs the name of the search". For example, the Job Title search option that you see on the screenshot above maps to a smart-y XPath 

    //ns:Emp.JobTitle[contains(.,"%1")]

    You can conceptually see that the JobTitle node will be searched for values specified somewhere. Hey, you might ask, where's that printf() syntax coming from?? You'll see an answer soon - we'll be doing a substitution of %1 for a real value coming from the fieldValue node in the web service code, described in detail below.

    The key-value pairs for this dropdown would likely come from a secondary data source - an XML file that you'd keep separately, and author using another InfoPath form. Here are some sample values:

    Display Name of
    the field to query
    Search XPath (value)
    Name //ns:Name[//ns:Name.First = "%1" or //ns:Name.Last = "%1"]
    Job Title //ns:Emp.JobTitle[contains(.,"%1")]
    Job State //ns:Location[ns:Loc.State = "%1"]

    2) fieldValue textbox: this allows the user to specify the value to search for. In the example above, they said that they want to search the "Title" field for the word "Manager".

    3) Run Query button: has a rule on it, with a few actions - using the Logic Inspector:

    Here we're setting the parameters on the secondary data connection that queries a web service; here's a screenshot of its data source:

    Why are we hard-coding the select XPath? Just for this example, it's likely that the basic info would be "show me the first and last names, and if I want to drill down, I will". Everything else is dynamic; if you'd like, you can specify selectXPath dynamically in the separate XML file mentioned in step 1.

    Now the web service method source code - the beauty is that it's completely generic, and you don't have to change anything in the web service

    [WebMethod]
    /* criteriaXPath must contain %1. It will be used to substitute in the criteriaValue
    * selectXPath must point to one, and only one text node (concat's are fine -
    *          just make sure that result can be casted to varchar)
    * None of the parameters should have a single quote in them: this is just a ,
    *          you may want to improve this before going to production (escaping).
    */
    public XmlDataDocument DoXQuery(string criteriaXPath, string criteriaValue, string selectXPath)
    {
        XmlDataDocument result = null;
        string criteria = criteriaXPath.Replace("%1", criteriaValue);

        using (SqlConnection conn = new SqlConnection(connString))
        {
            string command = @"
                WITH XMLNAMESPACES (
                    'http://tempuri.org/Resume' AS ns
                )

                SELECT
                    JobCandidateID AS id,
                    Resume.value('"
    + selectXPath + @"',  'nvarchar(128)') AS value
                FROM "
    + tableName + @"
                WHERE Resume.exist('"
    + criteria + "') = 1";
           
            SqlDataAdapter myCommand = new SqlDataAdapter(command, conn);
            DataSet ds = new DataSet();
            myCommand.Fill(ds, "JobCandidates");
            result = new XmlDataDocument(ds);
        }
        return result;
    }

     

    And you're done!

    Alex Weinstein
    Program Manager

  • Microsoft InfoPath 2010

    Manage data in your SharePoint Lists using the InfoPath Form Web Part

    • 3 Comments

    One of the powerful new features in InfoPath 2010 is the InfoPath Form Web Part.

    This is the 1st in a series of videos where we will show how to use the InfoPath Form Web Part to create rich mashups on portal pages in SharePoint, without writing a single line of code. In this video, Nick Dallett, a program manager lead on the InfoPath team, will demo two simple scenarios for managing data in your SharePoint lists using the InfoPath Form Web Part.

     

    Get Microsoft Silverlight

    Enjoy!

  • Microsoft InfoPath 2010

    Cool Forms! Team Status Tracking Form

    • 0 Comments

    This week’s cool InfoPath form is a form used by one of the teams at Microsoft to track their status. It uses conditional formatting for color coding the status to make it easy to see progress at a glance. By recording team status on their SharePoint site, everyone knows how the team is doing and where they need to focus their energy. As new milestones are added to the project, they are added to the form.

    Team Status

    If you have a “cool” form that you would like to share with us, please send an e-mail with the following details to coolform@microsoft.com -

    • Attach 1 or 2 screenshots of your form
    • Provide a brief description of the form
    • You may also attach the XSN file (optional)

    The most popular submissions will be featured on our blog in future posts.

    Check out other Cool Forms! here

    Thanks!

    The InfoPath Team

  • Microsoft InfoPath 2010

    Hiding hint text when conditionally hiding a repeating or optional control

    • 2 Comments

    Certain controls, such as repeating and optional sections and repeating tables, will display a link that, when clicked, will insert a new item into the form. By default, the text of this link, which is called hint text, is “Insert item” for repeating controls and “Click here to insert” for optional sections.  This text can be customized or turned off completely through each of these control’s property dialogs.

    In addition, the InfoPath Designer enables you to specify conditional formatting for these controls.  One of the actions that you can perform is to hide the control based on some condition.  When that condition is true, the control is hidden.  However, when the control is hidden, the hint text remains visible. This is often perceived as a bug in InfoPath but is actually by-design.

    The reason behind this is simple and makes complete sense once you understand it.  Very simply put, each of the repeating controls allows you to set conditional formatting on a per-row basis.  This means that you can specify a condition that will hide a specific row and not the entire repeating table or all instances of the repeating section.

    However, sometimes, especially in the case of optional sections, you wish to hide the entire control instead of just a single row.  The workaround for this is to put the control inside a section.  Then, set the condition which will hide the control on the section itself.  This will hide the section and all controls within it.

     

Page 7 of 12 (298 items) «56789»