Skip to main content

UNHIDE SHAREPOINT FIELD

I am writing this as a reminder for myself and for the sake of those that might need it.

You come across fields in SharePoint that only shows while using CAML query builder but wouldn't show in the UI. These fields are system generated as part of the content type or library.

To show them properly, you need to change a property called cantogglehidden which by default is readonly.

SPSite site = new SPSite("http://moss01");
SPWeb web = site.RootWeb;
web.AllowUnsafeUpdates = true;
SPField spfield = web.Lists["Accounts"].Fields["Document Type"];
Type type = spfield.GetType();
MethodInfo miinfo = type.GetMethod("SetFieldBoolValue", BindingFlags.NonPublic | BindingFlags.Instance);
miinfo.Invoke(spfield, new object[] { "CanToggleHidden", true });
spfield.Hidden = false;
spfield.Update();

QED

Comments

dan rogy said…
My current project requires ability to display choice column value via color or image associated with a choice

But Sharepoint standard packaged misses that control

I am looking for available solutions on market

I came across

http://sharepointfields.com


Does anybody has experiece using it?