Guide/Recommendations - IP2003 and support Apps - InfoPath Dev
in

InfoPath Dev

Guide/Recommendations - IP2003 and support Apps

Last post 05-02-2012 03:28 AM by DeanS. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 05-01-2012 03:27 AM

    • DeanS
    • Not Ranked
    • Joined on 04-24-2012
    • Posts 6

    Guide/Recommendations - IP2003 and support Apps

    Hi,

    I'm new to Infopath, although an experienced SharePoint / developer with good knowledge of VB / Java / HTML etc.  My client has IP2003 installed and uses SharePoint 2007.  I'm trying to set up a form in IP2003 to edit List data in stored in SP.  One approach I'm exploring is to pass the List ID from Sharepoint to Infopath via a URL using input parameters (link below).

    http://blogs.msdn.com/b/infopath/archive/2007/02/26/passing-data-into-a-form-input-parameters.aspx

    But, the Jscript code in the above (repeated below) returns an error:

    function XDocument::OnLoad(eventObj)
    {
          var bazValue = eventObj.XDocument.InputParameters["baz"].Value;
          eventObj.XDocument.UI.Alert(bazValue);
    }

    Within the MS blog, there is also C# code to do the same thing.  But I can only see Jscript and VB as possible languages in the Infopath install we have.  My questions are thus:

    1. What development tools should I request in addition to InfoPath?  I guess Visual Studio and possibly the Infopath SDK.  But can somebody advise on the versions that I should use (for IP2003/SP2007 which allows C#, Java, etc...)?
    2. There is mixed feedback on passing parameters to IP2003 using a URL.  Has anybody got this working?  Any tips or is this just impossible?

    Many thanks in advance for any quidance you can provide.

     Best regards,

    D

  • 05-01-2012 07:48 AM In reply to

    Re: Guide/Recommendations - IP2003 and support Apps

    Hi - what's the error?

    Visual Studio 2005 can be used with InfoPath 2003 or 2007 projects for adding managed code - I believe VS 2008 can also be used.

    If you have InfoPath 2007 installed, you can use VSTA for managed code development - I think even with the IP 2003 OM (sorry, it has been awhile - I've been using IP 2010 for a while now).

    It is not impossible to pass input params via URL - I do it all the time. :-)

    What does your URL look like?

    Hilary Stoupa

  • 05-01-2012 08:33 AM In reply to

    • DeanS
    • Not Ranked
    • Joined on 04-24-2012
    • Posts 6

    Re: Guide/Recommendations - IP2003 and support Apps

    Thank you for your reply Hilary.

    The exact error message is:

    'XDocument.InputParameters.ID' is null or not an object.

    The JScript to test this (as per blog):

    function XDocument::OnLoad(eventObj)
    {
    var idValue = eventObj.XDocument.InputParameters["ID"].Value;
    eventObj.XDocument.UI.Alert(idValue);
    }

    And, the URL and CommandLine commands are (the URL points to the file on a share currenty):

    file:///U:/02.%20P&MB/SharePoint/TE_FeeRecovery/FeeRecoverySAF%20(v01).xsn?ID=10 

    "U:\02. P&MB\SharePoint\TE_FeeRecovery\FeeRecoverySAF (v01).xsn" /InputParameters "ID=10"

    We currently only have IP2003 installed.  I have contacted IT to look at deploying IP2007, but will need to be distributed to a dept of 60 people, is currently unapproved, so may take some time.

    I am encouraged that you pass parameters all the time.  It feels like something that should be possible / easy.  But, using the JScript from the blog and the URL above doesn't seem to work.  Any tips / recommentations / things to try would be greatly welcome.

     Regards,

    D

     

  • 05-01-2012 08:52 AM In reply to

    Re: Guide/Recommendations - IP2003 and support Apps

    Are either approaches working? That is, are you failing with command line? Try using lower case for your parameter, both in your code and your URL.

    Hilary Stoupa

  • 05-01-2012 08:53 AM In reply to

    Re: Guide/Recommendations - IP2003 and support Apps

    I should add - you can use IP 2007 to design IP 2003 forms. Only you would need IP 2007 installed. Your form users could continue with IP 2003.

    Hilary Stoupa

  • 05-01-2012 09:07 AM In reply to

    • DeanS
    • Not Ranked
    • Joined on 04-24-2012
    • Posts 6

    Re: Guide/Recommendations - IP2003 and support Apps

    Hi Hilary.

    To confirm, neither command line nor URL are working.  And retested with lower case.  Alas ditto (same error).

    I have just been exploring further, and found a post from your good self back in 2008 saying "Parameters are new for IP 2007 and don't work with IP 2003 or the IP 2003 object model."

    http://www.infopathdev.com/forums/p/13370/47443.aspx

    It's all rather confusing as the InfoPath blog provides "legacy" code for 2003.  This is the code that I used (I'm on IP2003 SP3).  Have you managed to pass parameters to 2003?

    Thanks again.

  • 05-01-2012 09:14 AM In reply to

    Re: Guide/Recommendations - IP2003 and support Apps

    Well. Gee. I guess we know who not to listen to. I was totally spacing on the IP 2003 thing. The blog your code sample came from mentions the same thing:

    This blog article discusses a new feature of Microsoft InfoPath 2007 that makes it possible to pass data into an InfoPath form at load time

    And now that you mention it - nope, I've not done this with an IP 2003 form - it just isn't possible, to the best of my knowledge. Sorry for the wild goose chase!

    Hilary Stoupa

  • 05-01-2012 10:40 AM In reply to

    • DeanS
    • Not Ranked
    • Joined on 04-24-2012
    • Posts 6

    Re: Guide/Recommendations - IP2003 and support Apps

    Hi Hilary - no worries re the 2003 goose-chase.  I hope others reading this don't can benefit.

    I think the idea of developing in 2007 and saving in 2003 would be worth looking into.  I have requested 2010 as a pilot and this is installed now.  So, followed the instructions in your previosuly referenced message from 2008.  As such, I created a new blank form in 2010 and added the FormEvents_Loading(object sender, LoadingEventArgs e) code.  And saved as 2003 form.

    using System;

    using Microsoft.Office.Interop.InfoPath.SemiTrust;

    // Microsoft Office integration attribute. Identifies the startup class for the form. Do not modify.

    [assembly: System.ComponentModel.DescriptionAttribute("InfoPathStartupClass, Version=1.0, Class=Form3.FormCode")]

    namespace Form3

    {

    // The namespace prefixes defined in this attribute must remain synchronized with

    // those in the form definition file (.xsf).

    [InfoPathNamespace("xmlns:my=\"http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-05-01T17:29:03\"")]

    public partial class FormCode

    {

    private XDocument thisXDocument;

    private Application thisApplication;

    public void _Startup(Application app, XDocument doc)

    {

    thisXDocument = doc;

    thisApplication = app;

    // You can add additional initialization code here.

    }

    public void _Shutdown()

    {

    }

    public void FormEvents_Loading(object sender, LoadingEventArgs e)

    {

    try

    {

    string vDept = e.InputParameters["ID"];

    MessageBox.Show(vDept);

    //XPathNavigator myNav = CreateNavigator();

    //myNav.SelectSingleNode("/my:TestForm/my:Department", NamespaceManager).SetValue(vDept);

    }

    catch (Exception ex)

    {

    MessageBox.Show(ex.Message);

    }

     

    }

    }

    }

    But, I think i'm missing something in the use / namespace area (sorry, not that hot with C#).  As when I build the project I get "The type or namespace name 'LoadingEventArgs' could not be found (are you missing a using directive or an assembly reference?)".  If there a simple line that I need to add to fix this?

    Hopefully onto something here!

    Thanks again,

    Dean

  • 05-01-2012 10:43 AM In reply to

    Re: Guide/Recommendations - IP2003 and support Apps

    Well, here's the thing - input parameters are only available for forms that are using the IP 2007 object model or later. You won't be able to save as a 2003 format and have input parameters.

    Hilary Stoupa

  • 05-02-2012 03:28 AM In reply to

    • DeanS
    • Not Ranked
    • Joined on 04-24-2012
    • Posts 6

    Re: Guide/Recommendations - IP2003 and support Apps

    Yep, makes perfect sense.  Clearly flogging a dead horse here trying to get 2003 working.  I will push the IT guys see if we can get an upgrade to 2007/10.  Otherwise, need to find another way for IP2003 to interface with SharePoint lists.

     Many thanks for your help Hilary.

     D

Page 1 of 1 (10 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.