I have been using this method for some time now and decided to make a slight change to it. I have been using the PowerShell method found here to find the internal column names for my lists and libraries. It works great. The only problem with this is that I have to modify the script each time I need to change the value of the list or site. This is usually not a big deal since I generally am only looking at one list. This was not the case the other day. I needed to look at many different lists in the same site. Instead of having to modify the script each time, I added a set of parameters to prompt me at the command line. The code looks like this:
Param( [Parameter(Mandatory=$true,Position=1)] [string]$Site, [Parameter(Mandatory=$true,Position=2)] [string]$ListName ) ###### Declare Input Parameters -- Includes Hidden Fields ############ $web = Get-SPWeb $Site; $list = $web.Lists["$ListName"] $list.fields | select Title, InternalName, Hidden, Sealed, CanBeDeleted | where {$_.Hidden -eq $false} | sort title | ft -AutoSize
- Download Get Column Names Script
- Save the script to a directory on your SharePoint server
- Open the SharePoint Management Shell for PowerShell
- Navigate to the directory where you downloaded the script
example: d:\scripts - Run the script: getColumnName.ps1
- Enter in the variables
***To include hidden fields, change {$_Hidden -eq $false} to {$_Hidden -eq $true}***
Your screen should resemble the following before the command runs
Mike Smith has a lot of great tips on his site. I suggest that you check it out: http://techtrainingnotes.blogspot.com/
Stay Salty!