Attachments in InfoPath Form that is a Task Workflow

Woho, here is a nice one :), one of the small things that gets you sometimes bang your head for long long time till you find out what's the problem...

Symptoms:

So if you are having a workflow that uses InfoPath forms for tasks and you have attachment controls in it, then you probably faced this error: "The Selected file was not found"!!

Solution or Workaround:

  • Locate the ASPX page that your workflow form opens up in the _layouts directory on your server.

e.g., %Program Files%Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\

most probably you want WrkTaskIP.aspx --> this page is the one that loads your InfoPath form to be as a task form.

  • in this aspx page, locate the reference to MasterPageFile. This will look something like

MasterPageFile="~/_layouts/application.master"

  • Go to the masterPage file you found

In this case go to the application.master in the folder "%Program Files%Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\"

  • Look for the Form Tag

<form runat="server" onsubmit="return _spFormOnSubmitWrapper();">

  • Add the attribute enctype="multipart/form-data"  to this tag and save.

<form runat="server" onsubmit="return _spFormOnSubmitWrapper();" enctype="multipart/form-data">

  • iisreset and try your workflow with file attachment again.

Few things to Note:

as you can see, this is a product issue and hopefully it might be fixed in the SP1. But don't get frustrated, that's why we are blogging so you can find such information.

Have fun,,, :)