9
8

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.

PowerAutomateでドキュメントライブラリ上のファイルのIdを取得する

Posted at

簡単に。
Power AutomateでExcelのテーブルに行を追加するときにはファイルのIdが必要なのですが、これがちょっと厄介です。
ファイルのメタデータ取得のアクションでも取れないし、手でファイル名を指定してもエラーになります。

実際には 01A6HJUIMPNU3S3FBUSRBL6CX5S3DQPLPF のような文字列を指定する必要があります。

image.png

そこで、ファイルのIdを取得するために **「SharePointにHTTP要求を送信します」**のアクションを利用します。

image.png

方法はGET、URIは以下のように指定します。

_api/v2.0/drive/root:/test_folder/Test_file.xlsx

ここで /test_folder/Test_file.xlsx は対象のドキュメントライブラリ配下のファイルパスです。

image.png

このアクションの結果から、ファイルのIdが取得できます。

body('アクション名')?['id'] 式から左の数式を指定することで、ダイナミックにファイルの指定ができます。

以上です。

参考:https://twitter.com/johnnliu/status/1101587916042592256

9
8
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
9
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?