Вопрос

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.

Это было полезно?

Решение

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
});
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top