Author Archives: Stu

Impersonating Current App Pool User

Using SharePoint it’s easy to run a block of code with elevated permissions: SPSecurity.RunWithElevatedPrivileges(()=> { using (SPSite elevatedSite = new SPSite(siteId)) { using (SPWeb elevatedWeb = elevatedSite.OpenWeb(wedId)) { // operations using elevated SPWeb object… } } });SPSecurity.RunWithElevatedPrivileges(()=> { using (SPSite … Continue reading →

Posted in General | Tagged | Leave a comment

Enhanced Lookup Field – Part 4

This is the fourth and final part of the post describing how to create a custom lookup field for SharePoint. Other pages in this post are: Part 1 – Creating a custom lookup field type Part 2 – Add field … Continue reading →

Posted in SharePoint | Tagged , | Leave a comment

Editing SPView objects

SharePoint Short #14 Making a change to a SPView object directly will not work: listObject.DefaultView.Title = "new title"; listObject.DefaultView.Update();listObject.DefaultView.Title = "new title"; listObject.DefaultView.Update(); What you should do is instantiate a new variable from the view you want to make changes … Continue reading →

Posted in Shorts | Tagged | Leave a comment

Enhanced Lookup Field – Part 3

This is part three of the post on how to create a custom lookup field for SharePoint. Other pages in this post are: Part 1 – Creating a custom lookup field type Part 2 – Add field editor class Part … Continue reading →

Posted in SharePoint | Tagged , | 1 Comment

Handling Long Operations

SharePoint Short #13 Got some code that may take a while to complete? Good idea to let the user know they may have to wait a while, so put your code within the SPLongOperation block, as shown below, and it’s … Continue reading →

Posted in Shorts | Tagged | Leave a comment