Skip to main content

Elumenotion Blog

Go Search

 
Elumenotion > Elumenotion Blog > Posts > Anonymous Access to Add Items to Document Libraries
Anonymous Access to Add Items to Document Libraries

Update: A few days later a solution presented itself. Read about it here.

Long story short: I don't think it can't be done using the built-in list forms. If you can prove me wrong I will sing your praises to all who will listen.

Before writing the previous post in which I asked people to email me *shudder* their themes I tried to set up the document library to allow anonymous users to add new items to the library as you can do with most lists.

From the Settings Menu I chose Permissions for this Document Library:

And on the following screen I chose:

And finally I found myself on the screen where I could give anon the ability to add items to the list!

But alas!!! Thwarted again! Add, Edit, and Delete are all disabled.

Well, I don't need no stinkin' UI anyway. I'll just use code.

SPSite site = new SPSite("http://www.elumenotion.com");

SPWeb web = site.OpenWeb("blog");

SPDocumentLibrary lib = (SPDocumentLibrary)web.Lists["Themes"];

lib.AnonymousPermMask64 = SPBasePermissions.ViewListItems | SPBasePermissions.OpenItems | SPBasePermissions.Open | SPBasePermissions.ViewFormPages | SPBasePermissions.AddListItems;

After running the code I go back to the list and:

Hooray! I win! There is an upload button. Let's just test it shall we?

DOH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

After much experimenting I come to the conclusion that it just isn't meant to be with a document library without creating some custom bits that don't exclusively involve the list forms. I am hopeful that I can use impersonation to upload a file to a library via a user control or web part. But, I don't have time for that any time soon.

So, maybe I could use an attachment on a custom list instead of a document library? Nope, same deal.

Comments

Use a custom provider

Hi

We have had the same problem as you - SharePoint don't seem to be designed to have any interaction with anonymous users.

We did:
1. created an ordinary SharePoint site
2. extended the site and enabled forms authentication on the new site, using our very own custom build forms authentication, that just handles one "Guest" account
3. Gave the new Guest account proper rights to the list in question
4. Create a auto login page
5. Connected the dots, and the anonymous user is now signed in as Guest (through our own forms authentication provider) and can do whatever we grant the Guest the liberty to.

I'm not (yet) at liberty of sharing the exact solution.

Hope it helps.

soerennielsen.wordpress.com
Anon at 9/16/2007 5:23 PM

LIST instead of DOCLIB

i will make u do it.. but without code.. & without forms authentication...

TRY THIS WITH ME ...
1-open ur "central administration" .. "application management".. under "application security" click on "authentication providers".

2- from the drop down list on the right, choose ur site, & then click on default, & check enable anynonmous if it is unchecked then click on it to check it.

3- exmaple i created a team site, & went to the shared documents & i will do it on it...

4- first.. go to the site actions, then site settings, form the document center .. under users & premissions click on advanced premission.

5- click on settings.. anynonmous access.. check enitre site for now.

6- now create a form library [infopath] .. u have in this library now "new", "upload", "actions", & "settings" click on settings & choose "document library setting"

5- under premissions & management click on premission for this document libaray..

6- after enabling anynonmous from the central administration in our first step.. u will see "new", actions", "settings", but without enabling u can only see "actions"..
BUT now that we have enabled it, we can see all

7- click on "settings" .. click "anynonmous access" there u go..

THE TRICK

8- see ur browser URL, last five letter here are DOCLIB, make it LIST..

the diabled checkboxes will be enabled... here u gooooooooooooooooooooooooooooooooooooooooo
Mai Omar from ITegyptCorp... Experience You Can Trust [maio@itegyptcorp.com] at 11/29/2007 4:39 PM

Mai

Setting the permissions through code does the same thing. The upload button will display, but the user will be prompted to log in if they try to actually upload.
Doug Ware at 11/29/2007 4:45 PM

I know ..

Doug Ware..

I know it does the same, i just wanted to make it easier & faster..

u can do it by only 1min.
Mai Omar at 11/29/2007 4:50 PM

Wait

Wait.. actually upload..? mine was talking about uploading new item to ur document library while u r anynonmous user..
Mai Omar at 11/29/2007 4:52 PM

ERROR

Hello
I've just followed this tutorial and make anonymous access to
view and add items in my custom contact list . but after I 've added this anonymous access I got error in my contact.aspx form to add items this error message as follows:

The data source control failed to execute the insert command.

but when I chek the list I find that the data is stored successfully . I don't know why this error happen....

can spmeone tell how to solve it.....
Tamer at 3/15/2008 2:48 AM

Anonymous Access to Add Items to Document Libraries

After using this code still gettting the promt box for anonymous users. So, can you tell me what else i need to do..
Anon at 10/10/2008 2:30 AM

LIST instead of DOCLIB

Change DOCLIB to LIST does not work...I still can't add new item in document library
I believe I'm changing the permission of the LIST and not the permission of the DOCLIB.
Anon at 3/4/2009 7:59 PM

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Your Name *


Attachments
Follow me on twitter!
  Archive
  Archive (Calendar)
  Skinner Created Themes
  New Skinner Download
  New Skinner Tutorial

©  2009 Elumenotion, LLC  |   SharePoint Training, SharePoint Consulting and SharePoint Staffing
8075 Cavendish Place | Suwanee, Georgia 30024 | + 1 (888) 653-5021