Merry Christmas

Happy Christmas and a prosperous New Year, I hope 2013 is everything you expect and more!

Posted in General | Leave a comment

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...
        }
    }
});

This is fine for SharePoint related impersonations. Any code executed within the elevated block that authenticates using an object instantiated outside the RunWithElevatedPrivileges block will run using the context of the current user and not the elevated account. So for example, if you wanted to make a web method call using a single user (or connect to a database) and not the current context, the following code block will achieve this for you:
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:

This post describes how to implement the hidden related field for controlling the display within views.

Continue reading

Posted in SharePoint | 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:

For this post, I’ll describe the implementation of the field control class.

Continue reading

Posted in SharePoint | Tagged , | 1 Comment

Enhanced Lookup Field – Part 2

This is part two of the post showing how to create a custom lookup field for SharePoint.

Other pages in this post are:

This part will implement the field editor class.

Continue reading

Posted in SharePoint | Tagged , | Leave a comment