API使用にあたり、サイトIDなどの情報が必要なので事前にGETが必要
利用するAPIについて
-
シェアポイントにアップロードで使用するAPI drive
https://learn.microsoft.com/ja-jp/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=http -
Teamsチャネル通知 /teams/{team-id}/channels/{channel-id}/messages
https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http
Azure側設定
- アプリの作成
- アクセス許可の追加
Site.Read.All
サイトID、ドライブID、アイテムIDの取得方法
シェアポイントにアップロードの際必要なサイトID、チームID、チャネルIDをGraph Explorerで取得
Graph Explorer
https://developer.microsoft.com/en-us/graph/graph-explorer
サイトID検索
".com"で終わるシェアポイントのURLを入力
GET
https://graph.microsoft.com/v1.0/sites?search={URL}
例)
GET
https://graph.microsoft.com/v1.0/sites?search=https://test01.sharepoint.com
ドライブID
GET
https://graph.microsoft.com/v1.0/sites/{サイトID}/drive
アイテムID
GET
https://graph.microsoft.com/v1.0/drives/{ドライブID}/items/root/children