Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Microsoft Graph の SharePoint pages API について

Microsoft Graph の SharePoint pages API について

MiyakeMito

April 01, 2023
Tweet

More Decks by MiyakeMito

Other Decks in Technology

Transcript

  1. Microsoft Graph の
    SharePoint pages API
    について
    気ままに勉強会 #51

    View Slide

  2. Miyake Mito
    @MiTo60448639
    https://qiita.com/MiyakeMito
    株式会社アイシーソフト
    Technical Manager
    www.icsoft.jp
    https://speakerdeck.com/miya
    kemito
    2

    View Slide

  3. 免責事項
    当スライドは、
    2023年4月現在のバージョンでの情報です
    今後のアップデート等により、
    仕様変更する可能性があります。
    また、私の見解による内容が含まれます
    間違いなどありましたらご指摘ください。
    3

    View Slide

  4. 本日の参考サイト
    4
    ◼ sitePage リソースの種類(Microsoft Learn)
    https://learn.microsoft.com/ja-
    jp/graph/api/resources/sitepage?view=graph-rest-
    beta#pagelayouttype-values
    ◼ Microsoft Graph Pages API: Power Apps (+Power Automate) から
    SharePoint ページを作成しよう(平野愛 さん)
    https://shanqiai.lekumo.biz/sharepoint_technical_note/2022/12/
    power-apps-shar-2830.html

    View Slide

  5. Microsoft Graph の
    新しい SharePoint
    pages API

    View Slide

  6. Microsoft Graph の
    新しい SharePoint pages
    API の発表
    https://devblogs.microsoft.com/microsoft365dev/announcing-
    the-new-sharepoint-pages-api-in-microsoft-graph/
    1. SharePoint モダン ページ テクノロジの最新の開発に沿った新し
    いデータ モデル
    ➢ 水平/垂直セクション
    ➢ Webパーツ
    2. 以前のbeta API と比較して改善されたページ管理機能
    6

    View Slide

  7. 4月までにGAされる
    SharePoint Pages API
    ◼ 任意のサイトのすべてのページとニュース投
    稿のリストを取得します。
    ◼ 任意のページまたはニュース投稿のコンテン
    ツを取得します。
    ◼ ページまたはニュース投稿を作成する
    ◼ ページまたはニュース投稿を公開する
    ◼ ページまたはニュース投稿を削除する
    7

    View Slide

  8. Power Automate
    から実行

    View Slide

  9. Graph API 実行・・・
    9
    「HTTP 要求 V2 を送信する」も同様です

    View Slide

  10. Graph API 実行
    10
    1. アプリの許可で実行
    Create a page in the site pages list of a site
    https://learn.microsoft.com/en-us/graph/api/sitepage-create?view=graph-rest-beta#permissions
    2. 委任されたアクセス許可で実行

    View Slide

  11. Graph API を
    Power Automate で利用する
    11
    ◼ Microsoft Graph API について
    https://speakerdeck.com/miyakemito/graph-api-nituite
    ◼ Power Automate で Graph API 実行が無料
    https://speakerdeck.com/miyakemito/powerautomatedegr
    aphapigawu-chang-kamo
    https://speakerdeck.com/miyakemito

    View Slide

  12. webPart resource type
    ◼ 実際に作成したサイトページから、Web Partリソースを取得するのが
    オススメです
    12
    GET
    /sites/{sitesId}/pages/{sitePageI
    d}/webparts
    GET
    /sites/{sitesId}/pages/{sitePageI
    d}/canvasLayout/horizontalSecti
    ons/{horizontalSectionId}/colum
    ns/{horizontalSectionColumnId}/
    webparts
    GET
    /sites/{sitesId}/pages/{sitePageI
    d}/canvasLayout/verticalSection/
    webparts
    "properties": {
    "isMigrated": true,
    "layoutId": "Button",
    "shouldShowThumbnail": true,
    "imageWidth": 100,
    "hideWebPartWhenEmpty": true,
    "dataProviderId": "QuickLinks",
    "webId": "f07ee155-cdb5-45a3-8d51-1a0e278440ae",
    "siteId": "1f9a9f96-b55c-4ce1-bc84-a3c14b7b27be",
    "imagePicker": "/sites/TeamSite/SiteAssets/SitePages/Sample/画像1.png",
    "[email protected]": "#Collection(graph.Json)",
    "items": [
    {
    "thumbnailType": 1,
    "id": 3,
    "description": "",
    "altText": "",
    "rawPreviewImageMinCanvasWidth": 32767,
    "sourceItem": {
    "@odata.type": "#graph.Json",
    "itemType": 2,
    "fileExtension": "",
    "progId": ""
    },
    "image": {
    "@odata.type": "#graph.Json",
    "imageFit": 2,
    "minCanvasWidth": 1,
    "guids": {
    "@odata.type": "#graph.Json",
    "listId": "1d778c11-6259-44c3-98c1-fcdcd4db66f3",
    "uniqueId": "024c1110-d336-44de-972e-8494bdb87b87",
    "webId": "f07ee155-cdb5-45a3-8d51-1a0e278440ae",
    "siteId": "1f9a9f96-b55c-4ce1-bc84-a3c14b7b27be"
    }
    }
    }
    サイトページ
    Graph
    Pages/webparts
    API
    webpart の
    JSON Schema

    View Slide

  13. ありがとうございました

    View Slide