I\'m making issue tracking portal based on Sharepoint. Users should be able to add entries, but in the entry itself I want one column to only be visible to a specific group
You also can do this by register a CustomAction, and change list view schema dynamic
and in your control class:
class ColumnPermissionAction : Control
{
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
HideColumn();
}
private HideColumn(){
WebPart part=//find your web part
string colName="SecretColumn";
if(part is ListViewWebPart){
(part as ListViewWebPart).ListViewXml = (part as ListViewWebPart).ListViewXml.Replace(string.Format("", colName), string.Empty);
}else if(part is XsltListViewWebPart){
PropertyInfo property = typeof(DataFormWebPart).GetProperty("ListViewXmlDom", BindingFlags.NonPublic | BindingFlags.Instance);
if (property != null)
{
XmlNode xmlView = property.GetValue(part as XsltListViewWebPart, null) as XmlNode;
if (xmlView != null)
{
XmlNode node = xmlView.SelectSingleNode("//ViewFields");
if (node != null)
{
var field = node.SelectSingleNode(string.Format("FieldRef[@Name='{0}']", colName));
if (field != null)
{
node.RemoveChild(field);
}
}
}
}
}
}
}