Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a question regardint the top menu, where you have basically welcome menu, then you have there some other links and at the end "site settings" menu. And there for i have 2 questions:

1) How can i get the id's, names and sequences for existing items? For example you have there by default "Sign out', "my profile", "my settings", etc how can I know their structure what xml file should i investigate? (Microsoft.SharePoint.StandardMenu)

2) My second question is: how can I add dynamically / programmatically a new link just before the "Site Settings" menu? Basically i want to add there a link that will only appear if a feature is activated, is there a good way do it?

Any help is appreciated.

An update for previous post: Using the provided ID's i cant hide anything: So basically doing this:

  <HideCustomAction
  GroupId = "PersonalActions"
  HideActionId = "ID_PersonalInformation"
  Id = "ID_PersonalInformation"
  Location = "Microsoft.SharePoint.StandardMenu">
  </HideCustomAction>

Doesn't hide it.

share|improve this question

2 Answers 2

the best method I use is using features:

http://www.bjw.co.nz/developer/sharepoint-2010/102-adding-items-to-the-userwelcome-menu-in-sharepoint-2010

in the elements.xml

<?xml version="1.0" encoding="utf-8"?> 
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">   
   <CustomAction   Id="myCustomAction"   GroupId="PersonalActions"   Location="Microsoft.SharePoint.StandardMenu"   Sequence="1000"   Title="Google"   Description="Search away">     
       <UrlAction Url="http://www.google.com"/>   
   </CustomAction> 
</Elements>

the location determins where you want to put the feature, so for you Microsoft.SharePoint.StandardMenu this will display in the welcome menu

the Sequence determins the position of the item within the list(menu)

as for ID's they are the following:

Menu ID name            ||       Menu            ||     Menu text

ID_PersonalInformation,       The Welcome menu,           My Settings

ID_LoginAsDifferentUser,     The Welcome menu,       Sign in as Different User

ID_RequestAccess,            The Welcome menu,          Request Access

ID_Logout,                   The Welcome menu,            Sign Out

EDIT

the id's were taken from (f12 developer).

what your trying to do is not easy! In sharepoint 2007 I made my own feature that calls a .cs file, in that file im creating items and hiding items!

create a feature with the elements.xml referencing the .cs file; debug with no code within the .cs to make sure that its being called. within the .cs you need to use MenuItemTemplate

so within the createchildcontrols to hide the controls use:

                HideControls(new List<string>(new string[]{
                    "ID_PersonalInformation",
                    "ID_RequestAccess", 
                    "ID_PersonalizePage"}));

and to add menu items do:

              MenuItemTemplate schemeMenuItem = new MenuItemTemplate();
              schemeMenuItem.Text = userScheme.SchemeName;
              schemeMenuItem.ImageUrl = c_ImageUrl;
              schemeMenuItem.ClientOnClickNavigateUrl = userScheme.SchemeHome;
              schemeMenuItem.Sequence = i;
              this.Controls.Add(schemeMenuItem);

for a seperator use:

                    MenuSeparatorTemplate displaySchemesMenuSeparator = new MenuSeparatorTemplate();
                    MenuItemTemplate displaySchemesMenuItem = new MenuItemTemplate();

                    displaySchemesMenuSeparator.Sequence = 1000;
                    this.Controls.Add(displaySchemesMenuSeparator);

the last part is calling the method to hide the controls:

    /// <summary>
    /// hide controls
    /// </summary>
    /// <param name="controlsToHide"></param>
    private void HideControls(List<string> controlsToHide)
    {
        foreach (string controlToHide in controlsToHide)
        {
            Control control = this.FindControl(controlToHide);
            if (control != null)
            {
                control.Visible = false;
            }
        }
    }

with the method above you can change it slightly to ammend the control name to your liking :)

this is what i have made myself and works perfectly all the time :)

hope it helps :)

share|improve this answer
    
Nice, but how did you find those id's, which file contains them, and is it possible to replace one of those by my own? for example Sign Out instead of Sign Out i want to have a signature Log Out, And btw what are sequences for those elements (my settings, sign out, regquest access) –  Shkipper Jan 18 '13 at 9:54
    
Just also want to mention, doing this: <HideCustomAction GroupId = "PersonalActions" HideActionId = "ID_PersonalInformation" Id = "ID_PersonalInformation" Location = "Microsoft.SharePoint.StandardMenu"> </HideCustomAction> doesn't hide the my settings :( –  Shkipper Jan 18 '13 at 10:30
up vote 0 down vote accepted

At the end I solved the issue differently, basically I found the WelcomeMenu control, which is called Welcome.ascx in the hive Controltemplates.

I created a new controltemplate in my solution called it CustomWelcmoe.ascx, where I made my own modifications in visual part, as wel some custom modifications in codebehind, where i could show or hide some of the items in the menu basing on a feature that is activated or deactivated.

After i prefromed all the modifications I modified my masterpage and replaced the welcome control by my custom welcome control.

I deployed my solution and everything worked as a charm.

Happy coding.

PS: I'll post the whole solution soonish in my blog.

share|improve this answer

Your Answer

 
discard

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.