Make InfoPath attachment read-only

This InfoPath demo is the completed solution for recipe 79 of InfoPath 2010 Cookbook in which an InfoPath attachment is made read-only by selecting a check box.

In recipe 79, you will learn how to make a file attachment control read-only without losing the ability to open or view any files stored within the file attachment control.

Get more solutions from InfoPath 2010 Cookbook which is available on Amazon.com
OR
Watch the next InfoPath demo: InfoPath print view text on image overlay

InfoPath demo video transcript:

An often requested functionality in InfoPath is the ability to make a file attachment control read-only, for example, immediately after a form has been submitted, or if a particular user opens a form. In this recipe you will learn a trick you can use to make file attachment controls read-only based on a condition.

Here I've got the completed solution where I've placed a file attachment control and a check box control on an InfoPath form. Currently, I'm able to view the contents of the file stored within the file attachment control and I'm also able to delete the file stored within the file attachment control or attach a different file to the file attachment control if I wanted to. So this file attachment control is currently completely readable and writable right now.

If I select this check box, you'll see that the menu items with which I can change the contents of the file stored within the file attachment control are disabled and the other menu items are enabled, so I'm still able to view the contents of the file stored within the file attachment control, but I'm not able to modify anything about the contents of the file attachment control. So this makes the file attachment control read-only.

If I deselect this check box, you'll see that the file attachment control becomes completely readable and writable again.

 

Related InfoPath Demo Videos:

 

Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author.

 
InfoPath 2010 Cookbook: 101 Codeless Recipes for Beginners