5
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PowerShell で SharePoint の リストの列

Posted at
Add-PSSnapin Microsoft.SharePoint.PowerShell
$ErrorActionPreference = "Stop"

# リストの列の一覧(表示名、内部名、隠し属性、タイプ表示名)を取得
# 引数は、サイトURL($WebUrl), リスト表示名($ListDisplayName)
function getListFields( $WebUrl, $ListDisplayName ) {
    # サイト取得
    $web  = Get-SPWeb $WebUrl
    Write-Host "Web : $WebUrl"

    # リスト取得
    $list = $web.Lists | ?{ $_.title -eq $ListDisplayName }
    Write-Host "List : $($list.Title)"

    # 列の一覧を出力(表示名、内部名、隠し属性、タイプ表示名)
    $list.Fields | Select Title, InternalName, Hidden, TypeDisplayName
}
# 使用例 -----------------------------------------------------------------
$webUrl          = "http://hoge/my"
$listDisplayName = "ドキュメント"
# 例1)コンソールに出力
getListFields -webUrl $webUrl -listDisplayName $listDisplayName | Format-Table
# 例2)ポップアップビューに出力
getListFields -webUrl $webUrl -listDisplayName $listDisplayName | Out-GridView
# 例3)ファイルに出力
getListFields -webUrl $webUrl -listDisplayName $listDisplayName | Export-Csv -Path "(ファイルパス).csv" -Encoding UTF8 -NoTypeInformation
5
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?