1

I'm making a custom permission level where common end users can only view and add, then I simply add new custom permission level and apply it to my document libraries.

Everything goes fine, except that after user upload the document, it showed a dialog box "Access Required. This site hasn't been shared with you".

Then, I realized that the editform.aspx dialog is automatically called after every upload so maybe it needs "Edit Items" permission, and turned out I was right, gave end users Edit Item permission again and the upload works just fine now.

Note: I have an event receiver that handles ItemAdding and ItemAdded, their function is to automatically manage the properties and metadata value of my document library, so I want to disable Edit Item privillege for end users. I dont want them to mess with metadata nor the document itself. How else can I achieve this?

Thanks!

0

Add and Edit are two different base permissions. The behavior you see is perfectly expected, sinnce, as soon as the document is uploaded, the Add operation is done. The Edit dialog that then appears as technically Nothing to do with the Add, but all with Edit.

So you have actually two sources of problems here:

  1. Why does the Edit dialog appears?
    It appears under two conditions:
    a. If your document library as required columns, when you upload the document, it's checked-out (since it misses some required columns). If the document is checked-out, the Edit dialog does appear.
    b. Or if you have multiple content types associated to your doc lib.
  2. If you edit properties from your ER, it will fail as the ER runs under the identity of the user who triggered the action.
    Only an elevation of privileges could solve that one.
  • Yes, I'm aware that Add and Edit are two different things. I was trying to achieve only View and Add without the Edit. But then, this edit dialog appears everytime I want to add, so, my question is, in the doc library, should the Add always be paired with Edit for users to be able to upload? Because then I cant achieve the "View and Add" permission only. As for required columns, I dont have any extra required columns, but the basic column "Name" from content type Document is required.. – Windu Risky Adiatma Jan 30 '16 at 6:46
  • Name is required, but should be automatically filled with the file name at upload-time. Do you have different CT on the doc lib: as I wrote it's another cause of the Edit dialog to pop up. And, as I also wrote, Add and Edit are two different things: you're matter is to avoid getting the Editpage, which is possible under some conditions. – Evariste Jan 30 '16 at 6:52
  • Nope, I just have the "Document" content type here, and the doc lib setting has been set to not require check out. I will try your #2 suggestion in a moment, though, that could be the problem, will give feedback here ASAP.. Thanks for the suggestions! – Windu Risky Adiatma Jan 30 '16 at 7:00
  • 1
    I checked the code of the upload page (in Microsoft.SharePoint.ApplicationPages.UploadPage), and it actually looks like they redirect to the Edit page as soon as you have additional fields on the list (even not required). So, as you do have additional fields, your option is to change the default upload page to one of yours... :( – Evariste Jan 30 '16 at 10:14
  • Yeah, I was going to report that the ER elevated privillege was probably not the issue because it still didnt work. But, that's the first time I heard that one.. how unfortunate that we were forced to go through edit page like that! :( Guess I'll do just that, thanks for your help! – Windu Risky Adiatma Jan 31 '16 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.