need help for infopath attachment in SharePoint - InfoPath Dev
in

InfoPath Dev

need help for infopath attachment in SharePoint

Last post 02-08-2010 02:19 AM by elizas. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 02-23-2009 10:02 PM

    need help for infopath attachment in SharePoint

    Hi Patrick, Thanks for your reply. I’ll try to explain my scenario as simply as I can. I want to design a news site in SharePoint in which news data has to be submitted via a news submit form. I first wanted to use an InfoPath form. All the news submitted in the SharePoint database has pictures and attachments. My problem with InfoPath form is when I want to publish my form in SharePoint as a content type, I can’t define the attachment field and it gives me this error: “The selected field cannot be prompted because its data type is not supported: base64binary” Do you have any solutions or suggestions to resolve this problem? We have a MOSS2007 and InfoPath 2007. Thank you

  • 02-24-2009 12:15 AM In reply to

    • Anuma
    • Top 25 Contributor
      Female
    • Joined on 07-20-2005
    • India
    • Posts 525

    Re: need help for infopath attachment in SharePoint

  • 02-24-2009 12:55 AM In reply to

    Re: need help for infopath attachment in SharePoint

    Hi Mr. Aram Azari and thank you for posting,

    You are right. Promoted properties for InfoPath forms don't support images or attachments. I believe your error "The selected field cannot be prompted ..." should be "The selected field cannot be promoted..." please confirm.

    It sounds like you have the images and attachments under a separate repeating section (or separate fields). In other words, they are not part of some rich text field. To promote these images and attachments - without using code as Anuma's link suggests - you can use our free qRules v2.0 tool to upload them to a separate SharePoint document library. The InfoPath form uploads them using qRules which is a tool injected into yoru form. It replaces the images and attachments with a link. When you click on the link, the image or attachment is opened via the browser. That should meet your requirement!

    If you are using a rich text control and have images in it, it's more complicated. Rich text controls in InfoPath use XHTML format. There is a "plaintext" option that allows you to promote the text portion of the rich text control but this won't get you your images. To do that, you need to save the XHTML inner text to a database as a string and create a data view in SharePoint that displays the string stored in the database. We have a new feature in DBXL 2.4 (next version) that supports this, so if you need help you can send us e-mail and we can put you on the v2.4 beta plan.

    I hope this post was useful..

    Patrick Halstead
    Project Manager at Qdabra
  • 02-08-2010 02:19 AM In reply to

    Re: need help for infopath attachment in SharePoint

    The following example demonstrates how a file, uploaded through a file upload control is added as an attachment to a list item. using (SPSite oSPsite = new SPSite(http://website Url/)) { using (SPWeb oSPWeb = oSPsite.OpenWeb()) { oSPWeb.AllowUnsafeUpdates = true; // Fetch the List SPList list = oSPWeb.Lists["MyList"]; // Get the List item SPListItem listItem = list.GetItemById(1); // Get the Attachment collection SPAttachmentCollection attachmentCollection = listItem.Attachments; Stream attachmentStream; Byte[] attachmentContent; // Get the file from the file upload control if (this.fileDocAttach.HasFile) { attachmentStream = this.fileDocAttach.PostedFile.InputStream; attachmentContent = new Byte[attachmentStream.Length]; attachmentStream.Read(attachmentContent, 0, (int)attachmentStream.Length); attachmentStream.Close(); attachmentStream.Dispose(); // Add the file to the attachment collection attachmentCollection.Add(this.fileDocAttach.FileName, attachmentContent); } // Update th list item listItem.Update(); oSPWeb.AllowUnsafeUpdates = false; } } http://www.mindfiresolutions.com/lp/sharepoint-development.htm
    Cheers,
    Eliza
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.