.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> SharePoint >> Post New QuestionBookmark and Share Subscribe to Forum

what permission level RunWithElevatedPrivileges in SharePoint

Posted By: William Thompson     Posted Date: April 18, 2010    Points:2   Category :SharePoint
Under what permission level will RunWithElevatedPrivileges work
and
what is the use of using in
SPSite siteColl = SPContext.Current.Site;
SPWeb site = SPContext.Current.Web;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite ElevatedsiteColl = new SPSite(siteColl.ID))
{
using (SPWeb ElevatedSite = ElevatedsiteColl.OpenWeb(site.ID))
{
string SiteCollectionOwner = ElevatedsiteColl.Owner.Name;
string Visits = ElevatedsiteColl.Usage.Visits.ToString();
string RootAuditEntries =
ElevatedSite.RootFolder.Audit.GetEntries().Count.ToString();
}
}
});

Responses
Author: William Thompson             
Posted Date: April 18, 2010     Points: 5   

Hi,
I got the solution..

Whenever we use RunWithElevatedPrivileges the process which actually running the code will create new thread and that thread will running under the SharePoint webapplication's application pool identity - which is normally the "system account"

Author: Sunil Yadav       [Moderator]      
Posted Date: May 24, 2010     Points: 5   

Hi,

RunWithElevatedPrivileges runs with higher priveledges than the current user executing the code.
Lets say for example u have created a webpart which displays all the users form User Information List, in this case u need high privileged user to get list item from User Information List.This is where u need to user RunWithElevatedPrivileges.



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend