LoginSignup
1
1

More than 3 years have passed since last update.

Power Automate で SharePoint サイトコレクションのストレージ使用率を取得する

Posted at

はじめに

Power Automate を使えば SharePoint でファイル移動等の基本的なアクションができますが、Power Automate に用意されているアクションではできないこともあります。
そういう時は「SharePoint に HTTP 要求を送信します」というアクションを使える場合があります。
ここでは「SharePoint に HTTP 要求を送信します」を使って SharePoint サイトコレクションのストレージ使用率を取得してみたいと思います。

SharePoint に HTTP 要求を送信します

以下のように設定すると SharePoint サイトコレクションのストレージ使用率を取得できます。

image.png

サイトのアドレス にはストレージ使用率を確認したいサイトコレクションを指定します。
URI には _api/site/usage と入力します。
ヘッダーは下表のとおりです。

キー
Accept application/json;odata=verbose
Content-Type application/json;odata=verbose
X-RequestDigest $(\"#__REQUESTDIGEST\").val()

JSON の解析

「SharePoint に HTTP 要求を送信します」の実行結果は JSON になります。
「組み込み」の「データ解析」の「JSON の解析」で値を取得できるようになります。

image.png

ストレージ使用率は StoragePercentageUsed です。
スキーマ には下記を貼り付けます。

{
    "type": "object",
    "properties": {
        "d": {
            "type": "object",
            "properties": {
                "Usage": {
                    "type": "object",
                    "properties": {
                        "__metadata": {
                            "type": "object",
                            "properties": {
                                "type": {
                                    "type": "string"
                                }
                            }
                        },
                        "Bandwidth": {
                            "type": "string"
                        },
                        "DiscussionStorage": {
                            "type": "string"
                        },
                        "Hits": {
                            "type": "string"
                        },
                        "Storage": {
                            "type": "string"
                        },
                        "StoragePercentageUsed": {
                            "type": "number"
                        },
                        "Visits": {
                            "type": "string"
                        }
                    }
                }
            }
        }
    }
}

Slack メッセージについてはこちらも参考にしてください。

以上

1
1
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
1
1