Reviews..
| | |
This Month
July 2008
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Year Archive
Login
User name:
Password:
Remember me 
View Article  Welcome to SharePoint Zone!
I have chosen this zone for Sharepoint postings which would cover Windows Sharepoint Services 3.0, MOSS 2007, Infopath and Sharepoint Workflow, Office integration..etc..
View Article  How to elevate Permissions for using Sharepoint Object model
Many of the operations you perform with the object model—even a simple listing—will require administrative permissions. This is because SharePoint applies security restrictions to the use of the object model. However, there are many times when you would like to display information—such as a site listing—to a user that does not have administrator rights. In these cases, you must utilize the SPSecurity class to temporarily run object model code with elevated permissions. These elevated permissions allow you to run code under the identity of the application pool account.
          In order to run code with elevated permissions, you must encapsulate the code in a function that has no return value. You then create an instance of the CodeToRunElevated class using the name of the function as an argument. You can subsequently execute the code by calling the RunWithElevatedPrivileges method of the SPSecurity object and passing in the CodeToRunElevated object. Below shown is  an example that calls a method to list all of the available features in a farm.

<%@ Page Language="C#" MasterPageFile="~/_layouts/application.master"%>
<%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Import Namespace="Microsoft.SharePoint.WebControls" %>
<asp:Content ID="Content4" runat="server"
ContentPlaceHolderID="PlaceHolderMain">
<%
SPSecurity.CodeToRunElevated myCode =
new SPSecurity.CodeToRunElevated(ShowFeatures);
SPSecurity.RunWithElevatedPrivileges(myCode);
%>
</asp:Content>
<script language="C#" runat="server">
protected void ShowFeatures()
{
//Code goes here
}
</script>
WELCOME!
Hey there!, I am Purushotam R. Tumkur, an IT Engineer by profession working on Consulting, Development arena specially under Microsoft Technologies. The motivation to bring this site upfront is the reason I want to share my views, thoughts, capabilities and personalities through the channel of the world and technology has exposed to us as "boon". I limit my self through blogging by writing professional and personal thoughts. I am sure you will appreciate me in this matter, hope you will enjoy ride.


My favourites (opens new window)