Posts

Showing posts from June, 2011

SharePoint JavaScript On Demand SPSOD

http://www.ilovesharepoint.com/2010/08/sharepoint-scripts-on-demand-spsod.html Update: If you want to modify Item’s ECB Menu, please do not make a copy of core.js. Change     <SharePoint:ScriptLink language="javascript" name="core.js" OnDemand=" true " runat="server"/> ->     <SharePoint:ScriptLink language="javascript" name="core.js" OnDemand=" false " runat="server"/>   Add another webpart at the end of the page, override the “AddCheckinCheckoutMenuItem” (for hiding “Publish a Major Version”) function AddCheckinCheckoutMenuItem(m, ctx, url) {ULSsa6:;     var menuOption;     if(!HasRights(0x0, 0x4))         return;     if (currentItemCheckedOutUserId==SYSTEM_ACCOUNT_ID && ctx.CurrentUserId !=SYSTEM_ACCOUNT_ID)         return;     if (currentItemCheckedOutUserId==null)     ...

Hide a custom field from the Document Information Panel

  Set ShowInFileDlg to FALSE   static void SetShowInFileDlg(SPField f, bool value) { XmlDocument fieldSchemaXml = new XmlDocument(); fieldSchemaXml.LoadXml(f.SchemaXml); XmlAttribute attr = fieldSchemaXml.CreateAttribute( "ShowInFileDlg" ); attr.Value = value.ToString().ToUpper(); XmlNode fieldXmlNode = fieldSchemaXml.SelectSingleNode( "Field" ); XmlAttributeCollection fieldAttributes = fieldXmlNode.Attributes; fieldAttributes.Append(attr); f.SchemaXml = fieldXmlNode.OuterXml; f.Update( true ); }

Allow anonymous access to SharePoint application pages in the _layouts directory

  By default, the page is inherited from “LayoutsPageBase”. Change the inheritance from “LayoutsPageBase” to “UnsecuredLayoutsPageBase”.  public partial class HelloWorld : UnsecuredLayoutsPageBase Next, we need to override a property of the UnsecuredLayoutsPageBase, to allow the anonymous access. Be sure to change the ‘getter’ to return true  protected override bool AllowAnonymousAccess { get { return true; } }