SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an InfoPath 2010 form with a "Resume" attachment. When the form gets submitted to the SharePoint document library, I need to display the resume attachment as a document library's column. Every solution method that I am finding is based on InfoPath/SharePoint 2007, which is not working the same way with 2010. I know there should be a workflow to create in the SharePoint Designer, and can't figure out what it is. If anybody has this knowledge, please help.

share|improve this question

You will have to include custom code in the submit button of your InfoPath form and you will have to give the InfoPath form template Full Trust for the code to work in SharePoint.

// Retrieve the value of the attachment in the InfoPath form
XPathNavigator ipFormNav = MainDataSource.CreateNavigator();
XPathNavigator nodeNav = ipFormNav.SelectSingleNode("//my:document", NamespaceManager);
string attachmentValue = string.Empty;
if (nodeNav != null && !String.IsNullOrEmpty(nodeNav.Value))
    attachmentValue = nodeNav.Value;
    // Decode the InfoPath file attachment
    InfoPathAttachmentDecoder dec = new InfoPathAttachmentDecoder(attachmentValue);
    string fileName = dec.Filename;
    byte[] data = dec.DecodedAttachment;
    // Add the file to a document library 
    using (SPSite site = new SPSite("http://ServerName"))
        using (SPWeb web = site.OpenWeb())
            web.AllowUnsafeUpdates = true;
            SPFolder docLib = web.Folders["MyDocuments"];
            docLib.Files.Add(fileName, data);
            web.AllowUnsafeUpdates = false;

Please visit the Step 5 of this post to get the different options-

or view this post directly-

share|improve this answer

I would recommend to move all c# code out of the InfoPath form. Full Trust forms w/ code inside couldn't be deployed w/ CI or powershell to defferent SharePoint farms and that's pity.

In that case, it's better to move code to event receiver to sync attachments between InfoPath forms and 3rd part source like additional column/list/whatever it is.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.