Role of RunWithElevatedPrivileges

Explain the role of RunWithElevatedPrivileges.

- RunWithElevatedPrivileges executes code as the System account.

- This basically then means that the code that you supply as a delegate to the method, has full permissions to modify SharePoint objects in question.

- It executes the specified method with Full control rights even if the user does not otherwise have full control.

- RunWithElevatedPrivileges used with the SPSecurity.CodeToRunElevated constructor.

Syntax:
public static void RunWithElevatedPrivileges(
SPSecurity.CodeToRunElevated secureCode
)

- SecureCode object can be created from any method that is parameterless and returns void.
Role of SPWeb.EnsureUser method
SPWeb.EnsureUser method validates whether the specified login name belongs to a valid user of the website or not. If the login name does not exist then it adds the login name to the website........
Difference between SPSite and SPWeb object
The SPSite object represents a collection of sites, i.e. Site Collection, a top level site and all its sub sites......
Role of SPWebApplication object
The SPWebApplication class consists of various methods and properties to perform various manipulations on web applications....
Post your comment