I'll just give you an example how to use:
- Let's assume you have a calculated list column called "justAnyColumn" with the following formula "[Title]&[Content Type]"
- In this scenario we assume you don't need the title column, instead you want to show the "justAnyColumn" to select an entry. But unfortunately the context menu is attached to the title column. And now?!
- We could show the "Edit (link to edit item)" column in the view.
- May be a solution - But our users are accustomed to use the context menu. Well!
- Now you can use my script:
- Start the PowerShell
- Run my script as follows:
- PS> & .\AddMenuColumn.ps1 -webUrl http://[server:port]/site/subsite/ -listName "Test" -fieldTitle "justAnyColumn" -addToDefaultView $true
- Let's take a look at the result:
- Now you've got a new column, containing the value of "justAnyColumn" with attached context menu.
- That's all!
How to remove the column?
- Because the column is read only in the UI, you can't delete there.
- Instead use my iLovePowerShell script:
- PS> $web = get-spweb http://[server:port]/site/subsite/
- PS> $list = $web.Lists["Test"]
- PS> $field = $list.Fields["justAnyColumn"]; #better would be to use the Guid of the field, because the field name exists twice
- PS> $field.ReadOnyField = $false
- PS> $field.Update()
- PS> $field.Delete()
- PS> $web.Dispose()
Hope somebody can use this...