SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have added a menu item to the Personal Actions menu by creating a CustomAction like so:

    Title="My Link"
    Description="This is my custom link."
    <UrlAction Url="" />

However, I want a dynamic URL. There is a URL parameter that changes based on the current user. How can I make that happen? (By the way, this is an external URL, and not part of the SharePoint site.)

share|improve this question
up vote 2 down vote accepted

Create a custom ASP.NET page e.g. ApplPage1.aspx and then let user navigate to this page like this,

<UrlAction Url="_layouts/TestProject/ApplPage1.aspx">

Now in your Page.Load event of ApplPage1.aspx, check user's identity using,

SPWeb theSite = SPControl.GetContextWeb(Context);
SPUser theUser = theSite.CurrentUser;
string strUserName = theUser.LoginName;

Make sure you dispose SharePoint objects as otherwise it will be a massive memory leak. Once you got UserName, you can use If/else or switch statement to navigate user to website you want to navigate him.

Hope it helps.

share|improve this answer
Thank you. That does help. – Jeremy Jan 7 '13 at 22:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.