Browse SharePoint DataConnection - InfoPath Dev
in

InfoPath Dev

Browse SharePoint DataConnection

Last post 04-30-2008 07:41 AM by Dromont. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 04-30-2008 07:00 AM

    Browse SharePoint DataConnection

    Hi To everyone! I have a question for you! This is my first post but I know this site from 2/3 months and I know it is very cool! 

    In my infopath document I have 2 secondary data connection:
    1) "Procedura" a  data connection by SQL Server
    2) "testa_doc" a dtata connection by SharePoint Site

    I write this jscript code to query and browse the first data connection and it works:

    objDataObject = XDocument.DataObjects("Procedura");
    objDataObject.QueryAdapter.Command = "execute dbo.scegli_Versione " + "'" + CP5 + "', " + "'" + CP6 + "'";
    objDataObject.Query();
    ObjDataObject = null;

    var strXML;
    strXML = XDocument.DataObjects("Procedura").DOM.xml;
    var xmldoc = new ActiveXObject("Msxml2.DOMDocument");
    xmldoc.loadXML(strXML);
    try  { var CP7 = xmldoc.selectSingleNode("/dfs:myFields/dfs:dataFields/d:Procedura/@fdProceduraVersione").text; }
    catch(e) { XDocument.DOM.selectSingleNode("/my:myFields/my:VersioneNull").text = 1; }

    So, i write this jscript code to browse the other data connection (I dont need to query it)  and it doesent work:
    var strXML;
    strXML = XDocument.DataObjects("testa_doc").DOM.xml;
    var xmldoc = new ActiveXObject("Msxml2.DOMDocument");
    xmldoc.loadXML(strXML);
    var CP7 = xmldoc.selectSingleNode("/dfs:myFields/dfs:dataFields/dfs:testa_doc/@ID").text;
    XDocument.UI.Alert(CP7);

    The error is on the line 
    var CP7 = xmldoc.selectSingleNode("/dfs:myFields/dfs:dataFields/dfs:testa_doc/@ID").text;
    Object required.

    Could you help me?
    Thank you

  • 04-30-2008 07:33 AM In reply to

    Re: Browse SharePoint DataConnection

    You need to Query the SP data connection so that their is some data to browse.

    The same way you have to Query the SQL one.

    That is why the error says there is not an object.

  • 04-30-2008 07:41 AM In reply to

    Re: Browse SharePoint DataConnection

    Every time the form is opened the data of the SP DataConnection is retrived!
    But no problem, because I found the error! I have to add the namespace by this method: setProperty! Now it works!

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