Multiple Document Upload via infopath to sharepoint

  • 23 January 2008
  • 6 replies
  • 1 view

Badge +5

Hi All,


 Hope whoever is reading this is having a smashing day and is feeling nice and helpfull :-)


I was wondering if anyone has an example of or anything close that shows the uploading of multiple documents (ie, a word doci, tiff image ect..) from an infopath form via k2 into a sharepoint document library.


Many thanks in advance :-)


6 replies

Badge +9
Just to clarify, are you attaching multiple documents to an InfoPath form and then you want to pull these attachments from the form and load them into a document library?
Badge +5

Hi Tim,


Thanks for the reply, yes your description is correct.


 Cheers


Andrew

Badge +10

Hello there,


This is not my solution I would love to take credit for it but it actually came from one of our interal Solutions folks "Chyan"


In BP, using the SharePoint Document Template, various functions are supported, this include uploading and downloading documents (multiple documents in advanced mode), check-in, check-out, updating of metadata, etc etc.


 


   The challenge here is if you need to do this for multiple documents (e.g check-in and check-out) how do you do it? The functionality is not out of the box but that doesn’t mean it cannot be achieved. This applies to all functionalities in the Document Template Wizard, including uploading, downloading, and updating of metadata, undo check out, check-in and check out.


 


1.       Create the document wizard functionality. In this example I will be doing recursive check in of documents based on a Process Data Field (FileName) passed in. The value stores the documents I want to check in and the separator “;” is used to distinguished the various file names. For example: “MESubmission.pdf;Diagram.pdf”


2.       Go to code view of the event and make the changes to the code as follows. The yellow portion highlights the changes needed:


foreach (XmlNode checkInItem in checkInItems)


                {


                    foreach (string docName in K2.ProcessInstance.DataFields["FileName"].Value.ToString().Split(';'))


                    {


                                if (bool.Parse(checkInItem.SelectSingleNode("UsePartOfProcessItems").InnerText))


                            {


                                                ….


                                                checkInSet += "<DocumentName>" + docName + "</DocumentName>";


                                                ….          


                                }


                                else


                                {


                                                ….


                                                checkInSet += "<DocumentName>" + docName + "</DocumentName>";


                                                ….          


                                }


 


                                     }


                }


 


This has not been tested so play with it on a VPC or the like first.

Badge +5

Hi There,


 Many thanks for this, looks good to me i will give this a try


Cheers


Andrew

Badge +9

I may be missing the idea of what you are trying to do, but I'll offer up a solution for what I *think* you are trying to do.  If you have the InfoPath form integrated with your process (via the InfoPath Integration wizard), then that InfoPath form and all of its fields (including the attachments) will appear in the process XML.


Drag out a 'SharePoint Documents' event wizard, and specify that you want to 'Upload Documents' and select 'From K2 Field'.  You can then drag the field from the process XML that represents the attachment that you want to upload.  The rest of the wizard should be pretty straight-forward - identifying where you want to upload the file.  Note that you'll need to do this twice, once for each attachment that you want to upload. 


Does this hit what you are trying to do?

Badge +2

For anyone reading this old post, I was searching for a way to do this and found that Johnny has recently uploaded a blog entry with a .pdf detailing exactly how to accomplish this.


http://www.k2underground.com/blogs/johnny/archive/2009/11/03/the-proper-way-to-attach-files-in-k2-infopath-processes.aspx


HTH

Reply