Sujeewa Ediriweera

February 18, 2012

Accessing secure store service programmatically – part 02 (Impersonation)

Filed under: SharePoint — sujeewa.ediriweera @ 3:41 am
Tags: , , , ,

Over view
Although we have the run with elevated privileges option , In some cases  we need to execute specific functions with specific  user account privileges .Impersonation is very common when we are dealing with SharePoint services.


Initiate site object with different user token and execute code under nitiated site. You can do following

  • Create impersonate SPWeb object inside impersonated site object.
  • Get impersonate SPContext using impersonated site object.
  • Get impersonate SPServiceContext using impersonated site object.

You need to have a specific domain account to use as impersonate user. In my case I have setup a Secure Service Store Application key to retrieve impersonate user information


Code for Impersonation


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: