Submit Form To SP Library & Email using VB - InfoPath Dev
in

InfoPath Dev

Submit Form To SP Library & Email using VB

Last post 11-15-2012 04:05 PM by Hilary Stoupa. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 11-15-2012 01:56 PM

    Submit Form To SP Library & Email using VB

     Hi All,

     

    I'm trying to run a bunch of tasks through vb code entirely instead of using rules because of the way infopath 2007 operates (rules first/ code second). It's was going fairly well until I try to submit through VB code.  Below is the code I used that is giving me an error (Copied from:http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomizationlegacy/thread/e79ba632-aa41-4313-9d6d-2dc8ac15af24/):

        Dim fc As FileSubmitConnection = DirectCast(Me.DataConnections("Submit"), FileSubmitConnection)
        fc.FolderUrl = "http://YOURSERVER/YOUR-FORM-LIBRARY"
        fc.Execute()

     Here is the error I'm getting. Does anyone know how to decipher this?

    System.Collections.Generic.KeyNotFoundException
        The given key was not present in the dictionary.
       at System.ThrowHelper.ThrowKeyNotFoundException()
       at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
       at Microsoft.Office.InfoPath.Internal.DataConnectionsHost.get_Item(String name)
       at Equipment_Transfer.FormCode.CTRL105_15_Clicked(Object sender, ClickedEventArgs e)
       at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)
       at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)
     

     I've googled the error messages and it seems way over my head at this point anyway. Ill post code if need be. Basically what I'm trying to do with one button in VB is:

    1. Set CurrentStat field to "Submitted" (Done)
    2. Populate Edit History group fields (auto insert row into repeating table) with current user data using GetUserProfile connection (Done)
    3. Clear 4 fields in Current_User group (Done)
    4. Submit form to SP library (Need Guidance)
    5. Email form to recipients (Need Guidance)
    6. Close Form (Done)

    I know how to get this working using rules except for step 2 (auto insert new row).

    I know how get this working using vb except for step 4 & 5. I'm stuck either way....blahhhhhh. Thanks in advance for any assistance I may get.

  • 11-15-2012 04:05 PM In reply to

    Re: Submit Form To SP Library & Email using VB

    Well - dumb question, but usually I've seen this error when my data connection is wrong - i.e., my data connection name is "submit" instead of "Submit" - so, can you verify that "Submit" is actually the name of your submit data connection?

    Hilary Stoupa

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