Let me share an idea to change the "Quick Launch" item URL in SharePoint. I have taken an example like, setting the Home page URL at Site Page Feature Activation. I have written the method to set a home navigation and called at FeatureActivated event.
The method for Changing Home URL
private void SetHomeNavigation(SPFeatureReceiverProperties properties)
{
SPWeb web = properties.Feature.Parent as SPWeb;
if (web != null)
{
SPNavigationNodeCollection leftQuickLaunch = web.Navigation.QuickLaunch;
foreach (SPNavigationNode item in leftQuickLaunch.Navigation.QuickLaunch)
{
if (item.Title == "Home")
{
item.Url = "Your URL";
item.Update();
web.Update();
return;
}
}
}
}
Then, Call this method in FeatureActivated. That's all set.
No comments:
Post a Comment