I create Infopath forms programmatically and one of the items I want to include now is pictures.

Note: I have created list items programmatically with client object model with pictures in it using the hyperlink field and showing it like a picture but I don't see this option in Infopath, instead I see the picture component but it doesn't seems to accept urls or streams.

Note2: the images I want to use are from a picture library in the same SharePoint site.

How can be achieved?

  • How are you creating the forms programmatically? What method? Have you tried a byte array, or a base64 encoded string? – James Love Jul 19 '14 at 21:16
  • I use client object model from an asp .net page, I load the xml, I modify it and then savebinary to the original file. – Luis Molina Jul 20 '14 at 11:44
  • 1
    That's pretty clever. I don't know about the Picture component in InfoPath, but if it's anything like the Attachment component, the image and it's filename are combined and Base64'd, and Microsoft has code to work with them: support.microsoft.com/kb/2517906 – James Love Jul 20 '14 at 16:29
  • I've seen the link you send, the problem is that it works inside Infopath, if I try to copy that code to ASP .NET it doesn't found classes like XmlNamespaceManager for example, I need the code to do it in client object model in asp .net. – Luis Molina Jul 21 '14 at 5:37
  • This code works outside InfoPath fine, I've used it. You just need to add the missing references to your ASP.NET project. XmlNamespaceManager is within System.Xml.dll, for example. – James Love Jul 21 '14 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.