in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

OBA, SharePoint and Aghy [MVP]

November 2007 - Posts

  • Modify the inherited properties of a field

    One of my colleagues found a very interesting thing in SharePoint:: It's forbidden to modify the inherited field's properties (for example AllowMultipleValues defined by SPFieldLookup class) via properties! Doing this you start a back process, and the SharePoint donesn't use the field class anymore, but the fields will be created from the root class. Why? - That's a good question. Most likely because it's not supported.

    So you can modify the properties defined in the root class only with one method: through the schema. You can handle the schema vie SchemaXml, and the used Xml is depends on the ancestors of the fields. If you set the SchemaXml, the properties will be changed immediately, it's unnecessary to call Update method.

    By the way, you can find the schema descriptions at http://msdn2.microsoft.com/en-us/library/ms437580.aspx.

    On the OnAdded method you can modify the schema, because it's sure that here it exists. In other cases you can do this in the Update method, after calling the base.Update.

    private void SetSchemaAttribute(string attributeName, string value)

    {

    XmlDocument doc = new XmlDocument();

    doc.LoadXml(SchemaXml);

    XmlNode node = doc.DocumentElement;

    XmlNode namedItem = node.Attributes.GetNamedItem(attributeName);

    if (namedItem == null)

    {

    XmlAttribute attribute = doc.CreateAttribute(attributeName);

    attribute.Value = value;

    node.Attributes.SetNamedItem(attribute);

    }

    else namedItem.Value = value;

    SchemaXml = doc.OuterXml;

    }
  • Setting the Global Navigation

    By default the SharePoint menu is two level deep: it contains a major and a minor level, look like this:

     

    By the way: we can expand it! You need to open the master page, and edit the TopNavigationMenu property. The StaticDisplayLevels defines the number of the major levels, and the MaximumDynamicDisplayLevels defines the number of the deeper menu levels.

    The default value of the StaticDisplayLevels is "2", because the first level is the Home page, and the second one is its first subsites. The MaximumDynamicDisplayLevels has default value "1" - this defines to display only one deeper menu level.

    The following code example defines a menu with 3 deep levels:

          StaticDisplayLevels="2"
          MaximumDynamicDisplayLevels="3"

     

  • Hello SharePoint World!

    Hello,

    I've got Hungarian blogs: one about SharePoint-related topics, one about other IT topics, and one for my personal life (and my son). But I've never had any English blog, so that's it! My first English blog - about SharePoint. I've got some experiences since SharePoint 2001, and I think (I hope Geeked), I can write some useful information.

    By the way, I'm a senior consultant in my company. My tasks are planning SharePoint architecture, designing and managing our projects. Therefore I won't write deep development articles, but deep architecture and planning posts.In this blog I'm translating my former Hungarian articles, and write some new ones.

    Welcome in my SharePoint World! 


Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts