Programmatically Assigning Picture Field Information - InfoPath Dev
in

InfoPath Dev

Programmatically Assigning Picture Field Information

Last post 11-10-2009 09:44 AM by bafadam. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 11-09-2009 12:45 PM

    Programmatically Assigning Picture Field Information

    So, to start out with, I'm using this code right here http://support.microsoft.com/kb/892730 from the Knowledge Base article.

     I open up a new InfoPathAttachmentEncoder, navigate to my image (it all works) and then try and assign the Base64Encoding value to the field that is the picture field in the data source.

    Every time I do, I get a "schema validation found non-data type errors" error thrown by Visual Studio.  I've looked at the encoded date, and it seems to be doing the translation just fine...  I'm only using the VSTA, if that matters, and here's my exact code:

      InfoPathAttachmentEncoder ie = new InfoPathAttachmentEncoder("c:\\atb\\2_bigger.png");
      DOM.SelectSingleNode("/my:myFields/my:PersonsInformation/my:personPicField", NamespaceManager).SetValue(ie.ToBase64String());

    Thoughts?

    Filed under: ,
  • 11-09-2009 01:05 PM In reply to

    Re: Programmatically Assigning Picture Field Information

    Hi --

    You'll have to remove the xsi:nil attribute from 'personPicField' when you set its value. Here's a great blog post from the InfoPath Team with code samples.

    Hilary Stoupa

  • 11-10-2009 09:44 AM In reply to

    Re: Programmatically Assigning Picture Field Information

    Awesome. I no longer get the error, but the 64 encoding isn't working for me. I mean, it generates the 64 bit string, and I can look at it, but it' not the same as the string that's sitting in the field when I navigate to the picture and then put it there. Also, when the process finishes, the picture doesn't appear in the field at all. Any thoughts on THAT one? :)
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.