1
6

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 3 years have passed since last update.

SharePoint/OneDriveのドキュメントのURLを多少短くする

Last updated at Posted at 2019-04-05

共有用のURLが長い

SharePoint、OneDriveのドキュメントへのURLが非常に長くて、メールでURLを送るときは気をつけないとURLの途中で改行されてしまう問題があったりします。
短縮URLサービスを使うのも手ですが、Googleが短縮サービスを終了したようにセキュリティ上よろしく無い場面があったりします。Googleが短縮URLサービスを辞めたのは別の理由だったようですが。

短縮URLサービスを使わずに短くしたい

Google Driveは比較的短くて良い感じ。せめてあのぐらいの長さにしてほしいな。

URLの中身(SharePointの場合)

※(2020/6/24追記)下記URLはSharePointのサイト名が「office365」の場合です。下記URLの「office365」を適宜変更してください。
OfficeOnlineでOffice系ファイルを表示するとURLは以下のような感じになります(Wordの場合)。
https://xxxx.contoso.com/:w:/r/sites/office365/_layouts/15/Doc.aspx?sourcedoc=AAAA...AAAAA&file=BBB..(中略)..BBBB.docx&action=default&mobileredirect=true

とにかく長い。Word、Excel、PowerPointそれぞれでパラメータの種類が若干違いますが、sourcedocパラメータは必ず付いています。sourcedocパラメータ以外は省略可能っぽいので、sourcedocパラメータ以外は消しちゃいます。

https://xxxx.contoso.com/:w:/r/sites/office365/_layouts/15/Doc.aspx?sourcedoc=AAAA...AAAAA
多少は短くなりました。

ドキュメントの種類でURLが少しだけ異なる

のようです。
・Wordの場合
https://xxxx.contoso.com/:w:/r/sites/office365/_layouts/15/Doc.aspx
・Excelの場合
https://xxxx.contoso.com/:x:/r/sites/office365/_layouts/15/Doc.aspx
・PowerPointの場合
https://xxxx.contoso.com/:p:/r/sites/office365/_layouts/15/Doc.aspx

OneDriveの場合

↑はSharePointのURLだけでしたが、OneDriveもほぼ同じようです。
https://xxxx.contoso.com/:p:/r/personal/[ユーザIDのスネークケース]/_layouts/15/Doc.aspx?

注意点

上記はOffice Onlineで表示したときのURLの話なので、「リンクのコピー」からコピーできるURLには通用しません。パラメータのフォーマットが異なるようです。
*ダメな例
リンクのコピー

その他

・Google DocsのようにExcelだったらシート、PowerPointだったらスライドのURLが異なっているわけではない。これは残念。
・フォルダもダメ。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?