Book Sample Clarification - InfoPath Dev
in

InfoPath Dev

Book Sample Clarification

Last post 08-26-2005 02:27 PM by andywt. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 08-24-2005 05:35 PM

    Book Sample Clarification

    I have moved on to more difficult challenges with Infopath and
    Sharepoint and have found the examples in Chapter 9 very helpful. I am trying to adapt the example on page 296 "Extending Sharepoint Submit Example to Create a Task". My scenario is a bit different than the example in that the Sharepoint List is a Secondary Data Source instead of the Main one.

    I am having trouble with developing the equivalent code in step 14 for the "thisXDocument.DOM.selectSingleNode" as this snares the nodes from the Main document. How do I get the secondary nodes?

    Can you pass me a tip? Thanks in advance for your help!
  • 08-25-2005 04:39 AM In reply to

    Re: Book Sample Clarification

    Hi,
    Please refer your another post about how to get secondary dom
    http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=728

    Agni
    InfoPath Dev India
  • 08-25-2005 11:13 AM In reply to

    Re: Book Sample Clarification

    Thanks for the link. I'm still missing something (sorry to be so difficult) but the example in the book is:
    id = CreateTask( _
    thisXDocument.DOM.selectSingleNode("/my:myFields/my:title").text, _
    thisXDocument.DOM.selectSingleNode("/my:myFields/my:body").xml)
    which gets the Main document.

    If you had a secondary document named "secDoc" with the two fields
    title-"/my:Fields/my:title" & body-"my:Fields/my:body". What would the equivalent CreateTask( function above be? Just to be clear the secondary document is a Sharepoint LIST not a form.
  • 08-25-2005 04:19 PM In reply to

    Re: Book Sample Clarification

    hi andywt,
    You will need to create an IXMLDomDocument2

    Dim projectCategory As IXMLDOMDocument2 = e.XDocument.GetDOM("Project Category")
    projectCategory.setProperty("SelectionNamespaces", "Namespace")

    Here instead of "NameSpace" copy all of the namespaces like xmlns:xsi="..." from your secondary dom over to here. For details on the syntax look at the top at how the namespaces are set for the main dom. This will be at the top of your code file and will be autogenerated by InfoPath.

    Now get the correct XPath of the node that you are trying to access - You can do that by looking at the node structure in the data source pane.

    and write this
    projectCategory.selectSingleNode(...);

    and it should work.

    Shanthi
    InfoPath Dev India
    Shanthi Reddy
  • 08-26-2005 07:58 AM In reply to

    Re: Book Sample Clarification

    If I am not mistaken the code sample you suggest are for a FORM document. I am wanting to update a Sharepoint LIST. Am I missing something?
  • 08-26-2005 02:27 PM In reply to

    Re: Book Sample Clarification

    I'm sure you are glad to hear that I finally got it working using the web service interface to sharepoint. This is the code that was based on the book that I finally got adapted to my use:
    listName = "{B6FB0ADA-7507-44C7-A378-73A92B5771BE}"
    listView = "{06A69E6C-E9E2-409D-BD4E-CAB0DB7FDB31}"
    istsservice = New lists.Lists
    listsservice.Credentials = System.Net.CredentialCache.DefaultCredentials

    node = New XmlDocument
    node.LoadXml("" _
    + "<Batch OnError='Continue' ListVersion='1' ViewName='{DE609481-2F03-40F3-BA47-374D6631E6DE}'>" _
    + " <Method ID='1' Cmd='Update'>" _
    + " <Field Name='ID'>" + categoryCode + "</Field>" _
    + " <Field Name='LastNumUsed'>" + projectNum + "</Field>" _
    + " </Method>" _
    + "</Batch>")
    ' call the web service
    res = listsservice.UpdateListItems(listName, node)

    What drove me nuts as the use of "ID". This is a mandatory field that contains the item #. I was trying to use another field in the item and that did not work. Thanks for the suggestions and your patience.
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.