0

Is it possible to add a new column to all existing views of a list or I have to do manually for each view?

2 Answers 2

7

There is no way OOTB using the UI.

So you have to do it manually in the UI or through code (could be PowerShell).

If you create the column in the UI and deselect 'Add to Default View' and then run the following in 'SharePoint 2010 Management Shell':

$web = Get-SPWeb "http://sharepoint"
$list = $web.GetList("http://sharepoint/Lists/MyList")
$field = $list.Fields["NewColumn"]
0..($list.Views.Count-1) | foreach-object {
  $view = $list.Views[$_];$view.ViewFields.Add($field);$view.Update()
  }
2
  • Can please provide a link which explains it?
    – neo269
    May 14, 2012 at 4:55
  • 1
    Example added. Urls and names should be replaced May 14, 2012 at 5:24
1

You can see the link below, that has a PowerShell 1.0 code to use in SharePoint 2007 environment (that of course can be adjusted to use in SharePoint 2010 environment too)

http://antonioaugusto.com.br/blog/2013/03/19/como-adicionar-uma-nova-coluna-a-todas-as-visualizacoes-de-uma-lista-usando-powershell/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.