SharePoint 2013 anonymous access add attachments to list item


Sometimes you want to enable anonymous access to be able to add a list item but at the same time attaching some documents.

After good few hours playing around trying to make this work, turns out that we can achieve this functionality. The trick is to use RunWithElevatedPrivileges method for the file upload. We also want the file upload functionality to be available on the NewForm.aspx as it wouldn't make sense to put it in other forms as any user would be able to upload files to other records.

The result will be something like this:

When it is saved, the user is redirected to the display form:

The close button then will take the user back to the homepage (or any page you desire)

The steps:
1. Create an ascx control to host your file upload control in your project. 

Put the below script in the ascx as well (credit to this post):
The code behind:
2. Create custom form template. You have to put the ascx in the CONTROLTEMPLATES folder of the 15 hive. Then find ListForm rendering template from the DefaultTemplates.ascx and copy to the custom template ascx. Register the control from step 1 and modify the following table:

3. The last step is to add a FeatureActivated receiver in order to set the template name (I use content type for my lists). Also your code needs to break list inheritance and specify AddListItems permission for the anonymous users.



I am impressed by the quality of information on this website. There are a lot of good resources here. Thanks for sharing !

This comment has been removed by the author.
This comment has been removed by the author.

Andreas, Could you please point me to a guide or tell me where to put this code, is this a solution? do I need visual studio? Sorry for the dumb questions. thanks


how i can add code behind?


Can you share the solution file?


My name is Leah Brown, I'm a happy woman today? I told myself that any loan lender that could change my life and that of my family after having been scammed separately by these online loan lenders, I will refer to anyone who is looking for loan for them. It gave me and my family happiness, although at first I had a hard time trusting him because of my experiences with past loan lenders, I needed a loan of $300,000.00 to start my life everywhere as single mother with 2 children, I met this honest and God fearing online loan lender Gain Credit Loan who helped me with a $300,000.00 loan, working with a loan company Good reputation. If you are in need of a loan and you are 100% sure of paying the loan please contact (


Post a Comment