Submit Infopath form to a specific folder of Sharepoint library - InfoPath Dev
in

InfoPath Dev

Submit Infopath form to a specific folder of Sharepoint library

Last post 02-18-2011 11:00 AM by ramyasha20. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 04-07-2009 12:29 AM

    Submit Infopath form to a specific folder of Sharepoint library

    How can I submit form to a specific folder (depends of the value of field) of Sharepoint library?

    For example:

    The value of the field = "Nosov", then the form should be submitted to: http://.../DocLib/Nosov/

    The value of the field = "Zobov", then the form should be submitted to: http://.../DocLib/Zobov/

    Best regards

  • 04-07-2009 03:28 AM In reply to

    Re: Submit Infopath form to a specific folder of Sharepoint library

    Hi,

    You can do this using code below. Use this code in the submit button on click event.

    try

    {

    DAVAdapter oSharePoint      = (DAVAdapter)thisXDocument.DataAdapters["Adapter name"];

    oSharePoint.FileName         = "give the form name";

    oSharePoint.FolderURL        = "http://../DocLib/" + thisXDocument.DOM.selectSingleNode("XPath of your field").text;

    oSharePoint.Submit();

    }

    catch(Exception ex)

    {

              String str = ex.Message;

    }       

     

    Swathip
    www.ggktech.com
  • 04-07-2009 03:37 AM In reply to

    Re: Submit Infopath form to a specific folder of Sharepoint library

    Thanks a lot!

  • 12-28-2010 02:09 AM In reply to

    Re: Submit Infopath form to a specific folder of Sharepoint library

    Hi swathip ! I was a little known code, in the code above I can not find DAVAdapter library. Please, help me! My computer use Sharepoint 2007 and Info Path 2007.
  • 02-18-2011 03:51 AM In reply to

    Re: Submit Infopath form to a specific folder of Sharepoint library

     Is there a way to have code auto-create those folders based on Department/User?  For example:

     If User A, from Department IT submits a form, to have InfoPath form auto-create the destination if it doesn't exist to where it would be Leave Forms(Root) --> IT Department --> User A

     Thanks in advance! 

  • 02-18-2011 10:29 AM In reply to

    Re: Submit Infopath form to a specific folder of Sharepoint library

    You don't have to use code to create a folder. You can use the CreateFolder method of the dws web service. Create a data connection in your form to the web service. Set the url query param to the site specific folder name you wish to create (you could use a concat formula here, if you want to use form field values for the folder name) and query the data connection to create the folder.

    Hilary Stoupa

  • 02-18-2011 10:42 AM In reply to

    Re: Submit Infopath form to a specific folder of Sharepoint library

     Hey Hilary thanks so much! I'm rather a novice, could you assist by defining the steps? I'd ever be so grateful

  • 02-18-2011 10:55 AM In reply to

    Re: Submit Infopath form to a specific folder of Sharepoint library

    To create a new folder using the DWS web service, first create a data connection that receives data from a web service. The URL looks like this:

    http://<yourShPServer>/_vti_bin/DWS.asmx

    Replace <yourShPServer> with your actual server URL.

    When you click next, there will be some methods you can choose from. Select CreateFolder.

    In your form, when you want to create the folder, set the url query field of the new data connection to the folder you want in a rule:

    Shared Documents/DepartmentX/SomeotherThing

    You can use a concat formula:

    concat("Shared Documents/", my:DepartmentField, "/", my:SomeOtherField)

    Then for the next rule, query using a data connection -- this will be the data connection you just created and set the URL for. This will create the folder if it does not already exist.

    However, I think what you are then wanting to do is submit your form to that new folder. This thread has a code sample you can use, if you are comfortable with code. qRules has a command you can use (ChangeSubmitUrl) which may be a better way to go, depending on your coding skill level.

    EDIT: I was mistaked about this web service -- while it will create a folder in a document library, it apparently will NOT in a form library. It looks like the UpdateListItems method of the Lists web service may work, but I've not tried that.

    Hilary Stoupa

  • 02-18-2011 11:00 AM In reply to

    Re: Submit Infopath form to a specific folder of Sharepoint library

     I'm not comfortable with any of this, I'm an Infrastructure/Security guy but I've got to learn for Organizational needs.   Yes, what I'm trying to do exactly is if I submit a Leave Request and I'm in the NOC department, I'd like the form to create the Department folder and then the individual user folder if they don't exist, then place the form there.  This looks like it'll be a huge help, I'm reading as much as I can and I really appreciate all the help

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