Pregunta

¿Hay alguna manera de usarlo spsecurity.runwitheleVatedPrivileges condicionalmente. Por ejemplo, supongo que tengo un bloque de código, si se cumple alguna condición, quiero ejecutar este bloque de código en spsecurity.runwithelevatedprileges , de lo contrario quiero ejecutar este bloque de código sin spsecurity.runwithelevatedprivileges

¿Fue útil?

Solución

Ponga su código en un método con el retorno de vacío (requerido por el delegado).Posteriormente, use el IF para determinar su condición y el método real.

 //Run the MyElevatedFunctionCall function with elevated priviledges
       SPSecurity.CodeToRunElevated elevatedCall = new SPSecurity.CodeToRunElevated(MyElevatedFunctionCall);

Licenciado bajo: CC-BY-SA con atribución
scroll top