0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

SPOリストデータをCAMLクエリでPnP.PowerShellから取得

Last updated at Posted at 2024-11-16

CAMLクエリとは

・コラボレーション アプリケーション マークアップ言語 (CAML) のクエリ スキーマは、
 SPOリストデータを取得する際に使用できるクエリです。

選択肢の値を指定して取得(typeにChoiceを指定)

$spoUrl = 'テナントURL'
$listID = 'リストGUID入力' 
$query = @"
<View>
    <Query>
        <Where>
            <Eq>
                <FieldRef Name='カラムの内部ID'/>
                    <Value Type='Choice'>取得したい選択肢の値</Value>
            </Eq>
        </Where>
    </Query>
</View>
"@

Connect-PnPOnline -Url $spoUrl -UseWebLogin
$itemData = Get-PnPListItem -List $listID -Query $query
Write-Host $itemData
Disconnect-PnPOnline

テキストの値を指定して取得(typeにTextを指定)

$spoUrl = 'テナントURL'
$listID = 'リストGUID入力' 
$query = @"
<View>
    <Query>
        <Where>
            <Eq>
                <FieldRef Name='カラムの内部ID'/>
                    <Value Type='Text'>取得したいテキストの値</Value>
            </Eq>
        </Where>
    </Query>
</View>
"@

Connect-PnPOnline -Url $spoUrl -UseWebLogin
$itemData = Get-PnPListItem -List $listID -Query $query
Write-Host $itemData
Disconnect-PnPOnline
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?