How to Handle InfoPath File Aattachments

  • 6 January 2009
  • 3 replies
  • 0 views

Badge +6

Hi,


I am a newbie to K2 workflow. We have a requirement to create a request and attach a multiple documents to that request which we created. Each attachment is very big in Size, around 5 to 20 MB each one. One more thing to mention, we are using InfoPath 2007 form services i.e InfoPath Web browser.  So, to reduce the load on Infopath, we decided to create a sharepoint document library to hold the Infopath attachments and updated the SharePoint Document Library in Infopath has a hyperlink. Until this point, I implemented this feature using K2 Sharepoint Document Event Wizard when we start the workflow and updates the link next time we open the form and then Initiator submit the form for approval process in the workflow. I implemented this in one K2 workflow. In simple Words


Initiator --> Create a request with Attachments --> Initiator Submits--> Once Workflow Statered Replace the attachments with SharePoint Links --> submit to the Approver


But the issue is, Any body in the approver process can upload their documents to the request to support why they approved the request. so how can i upload each document to sharepoint Library and update the infoPath with link as soon as they upload the document to the InfoPath? Do i need to create a separeate workflow to handle the upload process, in that case i need some sample code or steps i need to follow or is there any other options to implement this.


Please help me on this.


Thank you very Much for your time to read this post.


3 replies

Badge +9
I have one warning for you, after reading your approach to file attachments which was very similar to my initial approach on a project.  We experienced tons of issues when attempting to manage large files (over 15mb) in InfoPath form services.  We ended up having to completely redesign our approach to file attachments and it cost us a lot of time on the project.  I would advise you to perhaps write your own little ASP form for handling file attachments, and pop it up off of your InfoPath form.  This will not only get around the forementioned issues, but also will give you more flexibility in addressing your initial issues.  Good luck!
Badge +6

Thanks for your suggestion. But i am not sure how to call a custom asp.Net page from InfoPath form using InfoPath Form Services. Can you provide me a sample code or steps to achive this fuctionality.


Thanks 


 

Badge +9

Well, it isn't going to be easy and your approach may change depending on your specific requirements, but here is what we did:


Create an ASP page to handle browsing/uploading attachments:



This page accepts a unique id of some sort (will be generated by the InfoPath page, I'll explain later)



Files that are uploaded are saved to SharePoint and a DB record is created containing the unique Id, URL to the file and other metadata (author, datetime, etc.) - we made a smart object to help manage this data.


On the InfoPath form:



Generate a unique Id for this instance of the form (based on form name + username +  datetime, perhaps?) Don't let this id change if the form is re-opened after submit, should remain static once it is generated.


Create a section to display the data in the DB related to this form's file attachments (using the unique Id) - integrate with the smart object to get this data easily.


Create a hyperlink ('Manage Attachments') that points to your ASP page, passing the unique form Id as a parameter


I hope this helps get you started, if you need specific information when you get into the thick of things, let me know and I'll try to help. 


 

Reply