Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Currently, I have to go to each List inside the SharePoint 2007 Site and use the Snipping Tools to copy the column information as shown below

enter image description here

The Question

Is there ways that I can copy all the column information for all the List in a SharePoint 2007 Site?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

You can develop a webpart or an application page

Or you can run the following in PowerShell on the server:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$s = [Microsoft.SharePoint.SPSite]("http://sharepoint")
$w = $s.OpenWeb()
$w.Lists | 
 Where-Object {!$_.Hidden} | 
 Select-Object @{Label="List";Expression={$_.Title}} -ExpandProperty Fields |
 Where-Object {!$_.Hidden} | 
 Sort-Object List, Title |
 Format-Table Title, Type, Required -GroupBy List > Fields.txt
$w.Dispose()
$s.Dispose()

This will put Title and Type of each non hidden field of each non hidden list into fields.txt from the site http://sharepoint

For PowerShell version 1:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$s = [Microsoft.SharePoint.SPSite]("http://sharepoint")
$w = $s.OpenWeb()
$w.Lists | 
 Where-Object {!$_.Hidden} | 
 Select-Object @{name="List";Expression={$_.Title}} -ExpandProperty Fields |
 Where-Object {!$_.Hidden} | 
 Sort-Object List, Title |
 Format-Table Title, Type, Required -GroupBy List > Fields.txt
$w.Dispose()
$s.Dispose()
share|improve this answer
    
+1 That's a good script. However, may I know how I can include the 'Type' and the 'Required' into the Fields.txt? Also, I have include a script for PowerShell ver 1 since I do not have the latest Powershell. –  Jack Aug 23 '12 at 9:23
    
The type should already be there and you can just add , Required to the Format-Table –  Per Jakobsen Aug 23 '12 at 9:55
    
Thanks Jakobsen. I notice that when I maximize my notepad to open the Fields.txt, I am able to view the column 'Type'. (It was far align to the right. Also, I have update both script to include the 'Required' field. –  Jack Aug 24 '12 at 2:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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