Link to the attachment - InfoPath Dev
in

InfoPath Dev

Link to the attachment

Last post 06-24-2010 06:35 AM by elizas. 14 replies.
Page 1 of 1 (15 items)
Sort Posts: Previous Next
  • 05-16-2008 11:30 AM

    Link to the attachment

    I have a simple Infopath form that could have 1 or more attachments. In some view I need to list out the names of all the Infopath forms and a link to the attachments of the respective forms. When the user clicks on the attachment they should be able to open the attachment without having to open the Infopath form.

    Please let me know if this is possible.

    Thanks in advance.

     

     

     

     

  • 05-16-2008 06:50 PM In reply to

    This is not possible as the attached file ends up being embedded in the form and is not accessible without opening the form in InfoPath.

    The best alternative is to store the files you want in a seperate document library or database and then rather than attaching them, put hyperlinks in the form to them. Then I believe you can promote the links text in Sharepoint and they would act as hyperlinks to the documents.

    So in the form just copy and paste the hyperlink in rather then attaching the file. The initial linkage takes a few more clicks but then you get what you are looking for on the backend.

  • 05-20-2008 01:43 AM In reply to

    Thanks for the reply.

    This is an application already deployed in the production and the attachments are embedded into it. I think there is an option to copy / download the contents of the attachment byte by byte and store it into some file located in the server.

     

  • 05-21-2008 03:13 PM In reply to

    Hi Thomas.

    During a recent project I have been developing a solution that:

    • Lets you add attachments to forms (also working on Broswer Forms)
    • Upon a triggered action (be it the submit event, or a subsequent implicit/explicit action on the form document from the sharepoint library it is stored inside) attachments are extracted and displaced into a specific document library
    • Links to the added documents are then inserted as XML fields inside the form data
    • Attachment stream are finally removed (so that the form file is kept small in size)

    Moreover, you also get "for free" (well ... it took some day to fine tune this solution :-)) the document management features of SharePoint for form attachments, i.e. attachments are versioned, you can add metadata (and then sort, group, filter etc ...), you can have policies applied, you can enforce check-in and check-out ...

    So, if you have time to develop some code, I would stronlgy suggest you this approach.

    Please let me know if you have doubts or questions.

    HTH

    Ciao

    Claudio Brotto
    MCT - MCSD - MCTS SharePoint
    http://www.devlizard.com
  • 05-23-2008 06:44 AM In reply to

     Thanks for the reply. I will definitely try to do this when i find time.

    My first question is

    1. How is Infopath and the attachments stored in the database? What is the format of storage?

    2. The items in my form library have an attachment embedded. I need to develop a Windows application that would download the attachments for a selected item. Any clue on how this could be done?

    Thanks. 

     

  • 05-24-2008 12:02 AM In reply to

    Attachments are not stored in the database, they are embedded as BASE64 strings inside the InfoPath XML document you create.

    They can be extracted (i.e. the BASE64 string can be decoded and the file stream can be infered from that).

    Please note that IP adds a small header at the top of the decoded file stream.

    Here you can find a couple of code snippets that can help you get started about attachments endoding: http://support.microsoft.com/kb/892730/en-us.

    If you need to develop an application (not limited to Windows Applications) that is capable of extracting the attachments, you should load the IP XML and parse it, so that you can read and decode the attachment element.

    In a windows applications reading data from a SharePoint library, this means you need to get access to the library.

    You can use the SharePoint object model, but consider that it is limited to applications running on the SP server.

    Otherwise, you can use the SharePoint web services from any location.

    Also, you can write your own remote access layer, using the technology you prefer, and use the OM if you run your layer on the server.

    HTH

    Ciao

    Claudio Brotto
    MCT - MCSD - MCTS SharePoint
    http://www.devlizard.com
  • 05-29-2008 11:33 PM In reply to

     Thanks a lot.

    I have managed to archive the Infopath form and extract the attachment. It is really amazing to see the way the data and the attachments of the Infopath form is stored.

     Thanks again for all the support i received.

     

     

     

  • 05-29-2008 11:45 PM In reply to

    I'm glad you could solve your issues.

     And ... yes, InfoPath is sometimes quite "surprising" ... and also quite a powerful tool IMHO.

    Ciao

    Claudio Brotto
    MCT - MCSD - MCTS SharePoint
    http://www.devlizard.com
  • 06-13-2008 06:21 AM In reply to

    Can you provide a step by step (with code) detail how you achieved this? I have same issue of extracting the attached files and copy them to sharepoint doc lib or to a network share.

    I tried to follow below links but...

    http://knrs.blogspot.com/2007/11/upload-infopath-attachment-to-document.html

    http://glorix.blogspot.com/2007_11_01_archive.html

    Thanks a lot 

     

     

     

  • 06-15-2008 12:46 AM In reply to

    Ciao andyoye :-)

    I will definitely work on this, since I think it's quite an interesting issue.

    I just have to find some free-time to package it all.

    So stay tuned :-)

    Ciao

    Claudio Brotto
    MCT - MCSD - MCTS SharePoint
    http://www.devlizard.com
  • 06-15-2008 12:40 PM In reply to

    Hi all,

    I have posted our solution that does what devlizard suggests here: http://www.infopathdev.com/files/folders/examples/entry29401.aspx

    This solution shows how you can copy InfoPath attachments to SharePoint document library and convert the Base64 string attachment in your InfoPath form into a link to the uploaded SharePoint document. You will need to modify the URL in ViewOptions.xml to point to your SharePoint site's document library.

    Note: this sample solution uses the taskpane to upload and convert the image attachments to SharePoint documents. This means that the form cannot be used in the browser. 

    Please let me know if you find this useful.

     

     

     

    Patrick Halstead
    Project Manager at Qdabra
  • 06-16-2008 07:41 AM In reply to

     Patrick: thanks, only issue is we use browser forms. Do you have a solution for browser enabled forms?

  • 06-16-2008 10:41 AM In reply to

     Devlizard: Thanks, standing by for the package.

  • 10-08-2009 04:30 AM In reply to

    Hello devlizard ,

    this is a very good post. I have a question reagrding a similar problem. I have a template and number of forms in SharePoint, which has several attachments inside. The users ad files up to 20MB, which is extreme when it comes to submitting/ openening the form. As you may already now, it is very bothering. So i came with the idea, that I should separate the attachments from the form and post the required attachment in a separate library. Thus using links I can directly access the attachemt from the form. So I do not need decoding, since my "database" is still in testing mode. I only required a submitting technique to upload files to SP library  using a simple button from the IP form. According to me I have a big issue. I have been looking through all the possible methods and object in IP but I cannot find something appropriate. I am using IP2003 with JScript. This is the last issue and the project will go productive. So i really need some hints or a bit help!

    Thank you in advance!

    Regards,

    Svetoslav

  • 06-24-2010 06:35 AM In reply to

    A list item in SharePoint can have multiple attachments. Below is a code snippet in c#.Net to add an attachment to a list item programmatically. This 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; Sharepoint migration 2010 Sharepoint migration services
    Cheers,
    Eliza
Page 1 of 1 (15 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.