How to get solutionVersion, productVersion and PIVersion for published InfoPath form?

avishnyakov
  • How to get solutionVersion, productVersion and PIVersion for published InfoPath form? avishnyakov

    I have to create an InfoPath form from c# code. So I use xsd.exe to create c# objects and XmlSerializer to compose xml files.

    Also I must define "mso-application" like "progid="InfoPath.Document" versionProgid="InfoPath.Document.3" (for sharepoint 2010) and "mso-infoPathSolution". I have problem with "mso-infoPathSolution" where I must define right "name" and "solutionVersion".

    I can get right name of InfoPath form by next code:

    FormsService service = SPFarm.Local.GetChild<FormsService>();
    service.FormTemplates["..."].Name
    

    but I can't find any solution for "solutionVersion" of Infopath form.

    How I can get "solutionVersion" for InfoPath form that was published on SharePoint?

  • I don't believe these make it into the file when using xsd.exe because they are processing instructions, not actually part of the XML data structure. If you need these then update the file as XML and use XPath queries such as:

    var ipsNode = xml.SelectSingleNode(
        "//processing-instruction('mso-infoPathSolution')",
        namespaceManager);
    ipsNode.InnerText = "TODO";
    

    I've been down the path of using xsd.exe but try to avoid it now and create my own entity classes. The XML template is stored within the form .xsn which can be extracted like a CAB file. This can be populated with XPath queries (and vice versa to read back). While it's more work up front, once done it is much easier to work with form data:

    • XPath queries can be written to be more flexible and resistant to changes in form structure
    • when problems occur they are easier to debug
    • working with your own code rather than something auto-generated
    • gives you more flexibility, e.g. able to set and extract processing instructions as part of reading the form
    • gives you entities that are not tied to being a particular type such as dataset

    Something to consider.

Tags
infopath
Related questions and answers
  • I need to change the tooltips in an infopath form using the code behind. How should I do that?

  • I have an InfoPath form that starts a workflow (on item created). The business requirement is that after submission form must be read-only (no changes to the initial request can be made). However workflow must change certain properties of the form (e.g. approval time, approval phase etc.). By default SharePoint workflows run under initiator account, however I am wondering would you recommend creating an event handler that is going to kick start a workflow under system account. Workflow would than be able to revoke all the contribute privileges but still be able to update the form during

  • I'd like to create a custom content type in SharePoint 2007 (WSS 3.0) that inherits from the existing XML Document content type (i.e. an InfoPath form) but I want to use custom ASP.NET forms to edit the XML. Is this possible and, if so, how?

  • when calling this code. Am I right in thinking that the ApplyWebTemplate() method of SPSite is asynchronous? If this is the case then my issue is probably one of timing. I.e. the required infrastructure is not yet in place when this code is run. ORIGINAL QUESTION I have a custom site definition which is using an SPProvisioningProvider to configure the site collection. After calling... 'PublishingHidden' being missing, but how can I restore this given that this is happening in the site collection provisioning process?

  • SharePoint workflow by nature is document centric in that you have to have a 'thing'; A object for the workflow to run on. This object can be a document, form or simple list item but this thing has to exist as the anchor and context of the workflow. What I've started thinking about is a more abstract sort of workflow and how it would be useful in SharePoint. Workflows are user driven processes... or automatic creation of an accident list item. Now the process will need to have a set of official forms filled in by various people. This is where I find SharePoint limiting me with it's document centric

  • I don't suppose there's a way to get an InfoPath task form to save it's state once it's submitted. In a workflow I don't delete the tasks, I just set them to complete. I don't pre populate much of the task forms as it's down to the user to complete the form. Some of the task forms are quite important and I'd like them to retain their entered fields after the workflow has moved on, or even completed itself.

  • I'm working on a prototype SharePoint site at the moment where a forms library has been created with an InfoPath form published to it. A content type has not been used, the form is bound directly to the forms library. This now needs to be put into a redeployable feature and solution package. I tried SPSource but the list definition it produced deploys as a document library. I also tried adapting MS' XmlFormLibrary feature with the same result. Is it possible to create your own Form Library list definition and if so, how?

  • I have this (an attempt to solve the task): <xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes... is: How do I write the XSLT to calculate and show the sum of all values in the "Distance" column in a Data View Web Part? The column might have empty values (does not have empty values now by the way... as far as I can see. The result is: xsum //Distance = 2. Update 3: This works. Had some problems with the selection of the start node but that should be fixed now. <xsl:decimal-format name="da-DK

  • I can create a CQWP for the Announcement content type, but when I export the .webpart and add <property name="CommonViewFields" type="string">Expires,Date;Body,text</property> In my ItemStyles.xsl I have added this to show all the returned fields <xsl:template name="ShowXML" match="Row[@Style='ShowXML']" mode="itemstyle"> <xsl:for-each select="@*"> <br... not. What should I be looking for? What could I have customized? Our admin does not yet have the latest service pack installed, nor do I get much of anything out of them support wise.

Data information