LoginSignup
0
2

More than 1 year has passed since last update.

Power Automate: SharePoint の チェックインコメントを取得する

Last updated at Posted at 2021-09-30

概要

SharePoint でのバージョン機能を利用した際に
チェックインの自動通知時に、チェックインコメントを一緒に通知させる

Automate の Action でコメントが取得出来なかったので、SharePoint Rest API でのコメントを取得する方法を記録

フロー概要

image.png

ポイントだけ JSON とか記述して説明

バージョン履歴取得

バージョン履歴取得例
_api/web/lists/getbytitle('Documents')/items(@{items('Apply_to_each_6')?['ID']})/versions

image.png

バージョン履歴のJSON解析

必要なとこだけに削除
{
    "type": "object",
    "properties": {
        "d": {
            "type": "object",
            "properties": {
                "results": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "FileVersion": {
                                "type": "object",
                                "properties": {
                                    "__deferred": {
                                        "type": "object",
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                }
                            },
                            "VersionLabel": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "FileVersion",
                            "VersionLabel"
                        ]
                    }
                }
            }
        }
    }
}

image.png

変更検知したバージョンにフィルター

image.png

あとは、CheckInCommentを取得して、よしなに

keywords

how to retreive "Check In Comment" in SharePoint by Power Automate

補足

Apply to Each が二回存在しているが、特に意味は無い
単に動的コンテンツ取得した際に配列だった為に自動で挿入されるものというだけ
First() とかでフィルターしたほうがフローは簡単になるけど、面倒なので放置してるだけ。

0
2
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
2