Overwriting infopath filename in SharePoint - InfoPath Dev
in

InfoPath Dev

Overwriting infopath filename in SharePoint

Last post 10-09-2007 01:36 PM by shaun.nieves. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 10-01-2007 04:25 PM

    Overwriting infopath filename in SharePoint

    I have an order tracking form. The form file name uses the customer name. If a user submits a form then comes back and changes the customer, a new file is created. I would like the existing file name to be updated if part of the file name is changed. Is this possible? I am currently using Patrick's excellent tip from his book on how to capture the file name on load and use it on submit but like I mentioned before, I need to be able to update the file name without creating a new record. Any help would be greatly appreciated. Thanks!

    Shaun Nieves
    Sharepoint Manager
  • 10-04-2007 08:24 AM In reply to

    Re: Overwriting infopath filename in SharePoint

    Sorry to take this thread slightly off topic, but you mention in your post "patricks excellent tip for captruing the filename on load". Would you mind sharing how to do this please or providing a link. Please PM if you dont want to post on here and take the thread too far off topic.

     thanks

  • 10-09-2007 01:36 PM In reply to

    Re: Overwriting infopath filename in SharePoint

    No worries, it looks like I've stumped the great minds here yet again.

    I got the code from Patricks book which I think is available somewhere on this site. It's called Developing Solutions with Infopath and is a great read.

     Place this in an onload procedure (it's in VB)

    If Not thisXDocument.IsNew Then
              Dim Submit As DAVAdapter
              Submit = thisXDocument.DataAdapters.Item("Main submit")
              If thisXDocument.URI.StartsWith(Submit.FolderURL) Then
              thisFilename = thisXDocument.URI.Substring(Submit.FolderURL.Length)
    End If

     In order for it to work you will need to declare thisFilename as a public variable

    To call it onSubmit,

    Dim Submit As DAVAdapter
                Submit = thisXDocument.DataAdapters.Item("Main submit")
                If thisFilename Is Nothing Then
                    thisFilename = Submit.FileName
                End If

    Submit.Submit()
    e.ReturnStatus = True

    For this portion to work your submit data connection must be named "Main submit" and it is case sensitive. Hope this helps!

     

     

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