5
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PowerShell で、SharePoint Online の リストとアイテムの情報を書き出してみた

Last updated at Posted at 2017-05-18

目的

SharePoint Online では、PnP.PowerShellを使って、
色々な情報を抜き出したり、書き込んだりすることができる。
これを使うと、簡単に管理作業が出来るので、これから色々なスクリプトを書いてみる。
(以前は、CSOMを使っていたが、PnP.PowerShellに置き換えてみた)

事前準備

以下のインストール

  • PowerShell Ver 5.0
  • PnP.PowerShell Ver.1.12 (PowerShell Ver.5で利用できる最新バージョン)
    インストールコマンド
    Install-Module -Name PnP.PowerShell -RequiredVersion 1.12.0 -Scope CurrentUser

設定箇所

siteUrlとlistNameを設定し、Entra IDでアプリ登録すれば実行できる。
都度、パスワードを入力していいのであれば、237行目か238行目のどちらかのコメントを外し、
241行目をコメントする。

# サイトURL
[string]$siteUrl = "https://tenant.sharepoint.com/sites/siteName",
# テナントID
[string]$Tenant = "",
# クライアントID
[string]$appId = "",
# 証明書の拇印
[string]$Thumbprint = "",
# リスト名
[string]$listName = "リストの表示名",

アウトプット

CSVに、SharePointのライブラリorリストのアイテム情報が出力される

サンプル

5
10
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
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?