Fully Trusted Forms - InfoPath Dev
in

InfoPath Dev

Fully Trusted Forms

Last post 07-26-2005 10:14 PM by Patrick Halstead. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 07-25-2005 06:05 AM

    • robmir
    • Not Ranked
    • Joined on 07-20-2005
    • Posts 4

    Fully Trusted Forms

    Hallo,

    I develop a form and I have made the form fully trusted with script because I use InfoPath 2003 Toolkit for Visual Studio .NET and access COM components and ActiveX controls.

    Dim objIP
    Set objIP = CreateObject("InfoPath.ExternalApplication")
    objIP.RegisterSolution ("blabla")
    MsgBox ("The InfoPath form template has been registered.")
    Set objIP = Nothing

    It`s ok.
    on my computer run the form ok, but I published the form on web server and when I try to start the form from other computer I keep getting an error message:

    "System.IO.FileNotFoundException
    File or assembly name Microsoft.mshtml, or one of its dependencies, was not found.
    at InfoPathProject1.InfoPathProject1.OnContextChange(DocContextChangeEvent e)
    at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnContextChange(DocContextChangeEvent pEvent)
    "

    AND for Context Sensitive Help (I did it how: http://blogs.msdn.com/philoj/archive/2004/04/25/119926.aspx):

    "File or assembly name Microsoft.mshtml, or one of its dependencies, was not found.
    at InfoPathProject1.InfoPathProject1.OnContextChange(...)
    at Microsoft.Office.Interop.Infopath.SemiTrust._XDocumentEventSink2
    _SinkHelper.OnContextChange(blabla)
    "

    Can you help me?
  • 07-25-2005 11:27 PM In reply to

    Hi Robmir,
    Are you using some special PIA for accessing the MSHTML code in the taskpane? If so, you'll have to instal this with the solution on the clients. Just guessing ...

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 07-26-2005 01:01 AM In reply to

    • robmir
    • Not Ranked
    • Joined on 07-20-2005
    • Posts 4
    Hi,

    thanks for reply.

    so I have added a reference in the project to Microsoft.mshtml.
    And in my OnContextChange handler I have written:

    if (e.Type == "ContextNode")
    {
    string aLoc=e.Context.nodeName;
    aLoc=aLoc.Replace("my:", "");
    HTMLTaskPaneObject taskPane=(HTMLTaskPaneObject)thisXDocument.View.Window.TaskPanes[0];
    mshtml.HTMLWindow2Class window=(mshtml.HTMLWindow2Class)taskPane.HTMLDocument.Script;
    window.execScript("waitForContext('" + aLoc + "')", "JScript");
    }

    @Patrick Halstead: I don`t know, what do You mean by "PIA".

    my second problem is, that I can`t use COM - Component on other computer. I have registered the templet with RegForm.exe (registration tool). With digital certificate and settings it´s all ok but it won't work.

    I keep getting an error message:

    "System.NullReferenceException
    Object reference not set to an instance of an object.
    at InfoPathProject1.InfoPathProject1.OnLoad(DocReturnEvent e) in c:\documents and settings\uid11518\desktop\infopathproject1\formcode.cs:line 604
    at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnLoad(DocReturnEvent pEvent)
    "

    this is OnLoad handler

    public void OnLoad(DocReturnEvent e)
    {
    try
    {
    cForm = new CodeForm(this); // I create new instance from Form here
    addGUI = new GUI4ADDClass(); // I call COM - Component
    bOK = addGUI.OpenConnection("","PROD",false);
    }
    catch(Exception e)
    {
    this.thisXDocument.UI.Alert(f.ToString());
    }
    }


    in other words on my computer it work and on other computer It won't work.

    I would be glad to have your explanation

    robmir
  • 07-26-2005 10:14 PM In reply to

    Hi Rob,
    PIA is the Program Interop Assembly for MSHTML so that you can call it from C# or VB.NET. If you installed this on your machine but not on others, it would explain the problem. This is similar to not installing the .NET Framework, but the error is a bit obtuse. Anyway, this MSHTML PIA for InfoPath .NET solutions has been blogged elsewhere. You should check that. It might not be the issue, but since you are calling code in script, you will need it.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.