Mask "Created By" and "Modified By" user names from forms and views

A small post about an interesting SharePoint feature: mask "Created By" and "Modified By" user account names from list item forms and views.

Masked user names

Masked user names

This behavior corresponds to a boolean property SPListItem.ShowUser. Specifying a value of true, the username will be seen, "***". This applies only to fields CreatedBy and ModifiedBy.

There are IsSecretFieldValue property and one of constructors in SPFieldLookupValue class:

public class SPFieldLookupValue
{
public SPFieldLookupValue(string fieldValue)
{
    if (!string.IsNullOrEmpty(fieldValue))
    {
        if (fieldValue == "***")
        {
            this.m_secretFieldValue = true;
        }
        else
        {
            // ...
        }
    }
}
// ...
}

Programmatically we can get the LookupId property, representing user ID, but LookupValue property returns us to "***". Although this constructor is public, it is useless for us, cause SharePoint throws an exception if we will be trying to save changes.

Vitaly Zhukov

Vitaly Zhukov

SharePoint Architect, Developer, Technical Trainer, Microsoft MVP (Office Development). Above 15 years of total experience working with SharePoint, Dynamics CRM, Office 365, and Microsoft stack development.

You May Also Like

Collect SharePoint telemetry with Azure Application Insights. Part I. Server-Side

Collect SharePoint telemetry with Azure Application Insights. Part I. Server-Side

SharePoint New Team Site. Inside Out

SharePoint New Team Site. Inside Out

SharePoint 2019 Preview

SharePoint 2019 Preview

SharePoint Ribbon. Creating multi level menu

SharePoint Ribbon. Creating multi level menu

SharePoint 2013. Geolocation field type

SharePoint 2013. Geolocation field type

SharePoint list item attachments' size

SharePoint list item attachments' size

SharePoint 2010. Custom forms for ContentType

SharePoint 2010. Custom forms for ContentType

SharePoint 2007. The max/min value of filed in SharePoint list

SharePoint 2007. The max/min value of filed in SharePoint list