Question

I'm new in sandbox and i'm developping an event receiver itemupdated and i need an alternative of runwithelevatedprivileges. I need it for using

item.file.moveTo("new libraray url");

I need it because user that move the item shouldn't have permission enough

The user can move file choosing a value in a select list but he can't go to the library where the item is mooved

Thanks for your help

Was it helpful?

Solution

RWEP is not available in the sandbox. Your alternative would be to grant a custom permission to the location where you are moving files to that grants the user Add Items or create a full trust proxy. For permissions, in your event receiver, you move the file normally. Users cannot modify items, users cannot delete items, only add new files. Fills the gap easily.

There is a MSDN article on full trust proxies for sandbox solutions that might help, http://msdn.microsoft.com/en-us/library/ff798482.aspx, but to me, this seems like overkill when a simple permission change can do the same thing.

OTHER TIPS

Instead of an event receiver, can you utilize the Content Organizer feature instead? http://msdn.microsoft.com/en-us/library/office/ee558288%28v=office.14%29.aspx

Your users can be given write access to the drop off library. They do not need access to the final destination library -- the content organizer process will move the on their behalf.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top