Add hidden metadata field to SPListItem

You need to add a new field to the list that is marked Hidden="TRUE".


You can do this via the object model:




using (SPSite sps = new SPSite("http://someServer/"))

{

using (SPWeb spw = sps.OpenWeb())

{

SPList spl = spw.Lists["Shared Documents"];


String strNewField = "";

try

{

spl.Fields.AddFieldAsXml(strNewField);

}

catch (SPException spe)

{

// Notify error that a duplicate name was detected

}

spl.Update();

}

}



Note : These hidden field will not appear when we try to create custom view using site action.

Comments

Popular posts from this blog

ContextSwitchDeadlock was detected

Visual Studio setup and deployment projects

Using SvcUtil.exe to generate the proxy class and config file