Domanda

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.

È stato utile?

Soluzione

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
});
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top