LoginSignup
2
4

More than 3 years have passed since last update.

SharePoint や OneDrive に保存したファイルを PDF でダウンロードする

Posted at

Officeファイルを開いて、PDF化するひと手間を省きたいときに使えるかも?

公式ドキュメント

別の形式でファイルをダウンロードする
https://docs.microsoft.com/ja-JP/graph/api/driveitem-get-content-format?view=graph-rest-1.0&tabs=http

実行例( SharePoint Online 向け)

以下を実行すると、数分だけ有効なダウンロードURLにリダイレクトされる。

GET
https://{hostname}/_api/v2.0/sites/{hostname}:/sites/{sitename}:/drives/{library-id※}/root:{filepath & filename}:/content?format=pdf

※{library-id} の調べ方
Driveも名前で指定したかったけど、みつからなかったのでidでやる。
以下を実行すると、指定のサイトにあるライブラリの一覧が取得できるので、その中から指定のライブラリのidを抜き出す。

GET
https://{hostname}/_api/v2.0/sites/{hostname}:/sites/{sitename}:/drives
2
4
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
4