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);
}

Comments

Popular posts from this blog

Setup SharePoint 2010

Register CSS to SP Master Page