Question

I have been working on a PoC in SharePoint, that on an EventReceiver handling items added or updated in Document Libraries, has to copy the file in a temporary folder.

I would want to know, is there a way to know which user will be writing the file in the folder? Because as this might be working on different servers, permissions must be given.

Était-ce utile?

La solution

Use SPSecurity.RunWithElevatedPrivileges for all disk operations because incoming user is unlikely to have permissions to write anything to server's file system.

SPSecurity.RunWithElevatedPrivileges(delegate()
{
    // open/write/close file here. 
    // Avoid touching SPxxxx objects from outside of this delegate
});
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top