Sunday, March 13, 2011

How to add an application server role to your SharePoint farm

To add an application sever with an application server role to your SharePoint farm run this PowerShell commands:

  1. Connect-SPConfigurationDatabase -DatabaseServer "MySqlServer" -DatabaseName "MySharePointFarmName_SharePoint_Config" -Passphrase "myPassPhrase"
  2. Install-SPHelpCollection -All
  3. Initialize-SPResourceSecurity
  4. Install-SPService
  5. Install-SPFeature -AllExistingFeatures
  6. Install-SPApplicationContent


For more infomation on this read this technet article “Add a Web or application server to the farm (SharePoint Server 2010)” - http://technet.microsoft.com/en-us/library/cc261752.aspx

Tuesday, March 1, 2011

Remove the SharePoint menu item “Edit in SharePoint Designer” in Site Action

I had a customer who wanted to remove the menu option "Edit in SharePoint Designer" in the site action. It was not simply enough to disable edit in SharePoint Designer in central administration, for it does not remove the the menu item but make it just gray.
My first thought was to make a Hidde custom action, but it turns out that many of the items in the site action can not remove by a Hidde custom action. It turns out that the menu items in the site action is hardcore in the master pagen. eg. v4.master. So we have four solutions to the problem position.
1) We can remove the rights of the logged on user.
2) In v4.master file, remove the line 147 to 157th
3) Do some JavaScript that remove the menu item
4) Make a custom control or delegate control ala:

  1. SPRibbon ribbonControl = this.Parent.Controls.Cast<Control>().First(c => (c is SPRibbon)) as SPRibbon;
  2. SPRibbonPeripheralContent ribbonPeripheralContent = ribbonControl.Controls[0] as SPRibbonPeripheralContent;
  3. SiteActions siteActions = ribbonPeripheralContent.Controls.Cast<Control>().First(c => (c is SiteActions)) as SiteActions;
  4. FeatureMenuTemplate featureMenuTemplate = siteActions.Controls[0].Controls[2] as FeatureMenuTemplate;
  5. Control editInSharePointDesigner = featureMenuTemplate.Controls.Cast<Control>().First(csd => (csd is MenuItemTemplate) && ((MenuItemTemplate)csd).Text.Equals("Edit in SharePoint Designer", StringComparison.InvariantCultureIgnoreCase));
  6. featureMenuTemplate.Controls.Remove(editInSharePointDesigner);