2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Power AutomateでSharePointリスト添付ファイルリンク抽出時の注意

Last updated at Posted at 2025-06-23

緒言

Power AutomateでSharePointリストの添付ファイルのURLをそのまま承認アクションに貼り付けると、ファイル名に空白(スペース)が含まれている場合にリンクが壊れてしまうという問題発生。
ただencodeUriComponentを使うだけでは解決できませんでした。

問題詳細

下図のような添付ファイルがある場合を例にします。
image.png

このAbsoluteUriを抽出して承認アクションに貼ると、下図のように空白部分でリンクが途切れてしまう。
image.png

対策失敗例

取得した AbsoluteUri 全体をencodeUriComponent関数で囲んでみると、下図のように:/までエンコードされて失敗。

https%3A%2F%2Fyourtenant.sharepoint.com%2・・・

対策成功例

concat(
  replace(
    items('For_each')?['AbsoluteUri'],
    last(split(items('For_each')?['AbsoluteUri'],'/')),
    ''
  ),
  encodeUriComponent(
    last(split(items('For_each')?['AbsoluteUri'],'/'))
  )
)

上記のようにファイル名部分だけエンコードすればOK。

リスト名に空白が含まれてたりすると同様のリンク途切れ発生するのでさらなる工夫必要

結言

いろんなことを想定しないといかんなと学びました。。。
最近エンコード関係でつまづきすぎ。。。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?