Programmatically mask the created by and modified by in the SharePoint list edit and display forms

In this article we will be seeing how to mask the created by and modified by in the SharePoint list edit and display forms as shown in the following


Using C#:

  1. using System;

  2. using System.Collections.Generic;

  3. using System.Linq;

  4. using System.Text;

  5. using Microsoft.SharePoint;

  6. using System.Xml;

  7. namespace MaskUser

  8. {

  9. class Program   

  10. {

  11. static void Main(string[] args)       

  12. {

  13. using (SPSite site = new SPSite("http://serverName:1111/"))           

  14. {

  15. using (SPWeb web = site.RootWeb)               

  16. {                 

  17. SPList list=web.Lists["cl"];                   

  18. list.ShowUser = false;                                

  19. list.Update();                

  20. }           

  21. }       

  22. }   

  23. }

  24. }

Using PowerShell:

  1. $site=Get-SPSite "http://serverName:1111/"

  2. $web=$site.RootWeb

  3. $list=$web.Lists["cl"]

  4. $list.ShowUser=$false

  5. $list.Update()

Recent Posts

See All