C# Saving form using field values - InfoPath Dev
in

InfoPath Dev

C# Saving form using field values

Last post 08-04-2009 09:02 AM by krazykarter. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 07-31-2009 01:43 PM

    C# Saving form using field values

    Another simple question. I am trying to save my form using this.SaveAs();, and as the file name I am combining a path with a field value. To complicate things more, that field value is an integer.

    this.SaveAs("SharepointWebsite/" + integer_field_value)

    I tried using .ToString(); but that did not work either. How can I add the value from the field to the name of the file?

     Thanks in advance.

  • 08-04-2009 07:27 AM In reply to

    Re: C# Saving form using field values

    To make things a little simpler, I changed the field type to a string, but still cannot figure out how to use this value as part of the file name when saving the file.
  • 08-04-2009 07:58 AM In reply to

    C# Using a field name as part of file name in this.SaveAs()

    I am trying to save a file using this.SaveAs(), but cannot figure out how to include a field name in the title.

    The field is called 'field1' and is in a group called 'form_info". I am trying to save the form as "File - XX", where XX = field1. How can I use this field value in the file name?

     

     Thanks in advance.

  • 08-04-2009 08:25 AM In reply to

    Re: C# Saving form using field values

     Could we see the code you're using to get the field's value?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-04-2009 08:35 AM In reply to

    Re: C# Saving form using field values

    That's the problem, I don't know what code to use.

    The field is called "field1" (because I'm original) and belongs to a group called Form_Info. My latest attempt was

    this.SaveAs(String.Concat("http://document_library/FILE - ", my:Form_Info/my:field1));

     Note: this.SaveAs... is all 1 line, don't know why it is splitting it up here.

  • 08-04-2009 08:48 AM In reply to

    Re: C# Saving form using field values

     I suggest you read these first:

    http://www.bizsupportonline.net/infopath2007/infopath-2007-frequently-asked-questions-faq.htm#how-to-retrieve-field-value-from-code
    http://www.bizsupportonline.net/infopath2007/retrieve-value-infopath-form-field-code.htm
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-04-2009 09:02 AM In reply to

    Re: C# Saving form using field values

    Thanks, got it to work.

    I used the second link, as it actually had an explanation to go with the code fragment it gives you.

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