- ユーザマニュアル /
- Virtual DataPort 管理ガイド /
- データソースと基本ビューの作成 /
- Software as a Service ウィザード /
- OData 向け SharePoint
OData 向け SharePoint¶
OData 向け SharePoint ウィザードを使用すると、以下の SharePoint OData エンティティのデータソースと基本ビューを取得できます。
Appdata
Appfiles
Attachments
Books
ComposedLooks
ConvertedForms
Documents
Events
EventsCategory
FormTemplates
ListTemplateGallery
MaintenanceLogLibrary
MasterPageGallery
MasterPageGalleryCompatibleSearchDataTypes
MasterPageGalleryCompatibleUIVersionS
MasterPageGalleryStandalone
MasterPageGalleryTargetControlType
MasterPageGalleryTargetControlTypeSearch
MasterPageGalleryTemplateLevel
SearchConfigList
SearchConfigListScope
SharePointHomeOrgLinks
SitePagesSitePageFlags
SitePages
SolutionGallery
StyleLibrary
TaxonomyHiddenList
ThemeGallery
UserInformationList
WebPartGallery
WebPartGalleryGroup
WebPartGalleryRecommendationSettings
OAuth 2.0 資格情報の取得¶
OData 向け SharePoint ウィザードを構成するための OAuth 資格情報を取得するには、以下の手順に従います。
サイトのレルムの取得 レルムはサイトの不変 GUID です。これを取得するには、Postman などのツールを使用できます。レルムを取得するには、以下の手順を行う必要があります。
以下のように GET リクエストを行います。
https://<tenant_name>.sharepoint.com/_vti_bin/ListData.svc
ヘッダー。認可: Bearer
WWW-Authenticate 応答ヘッダーから Bearer レルムコンポーネントを取得して保存します。この値は tenant_id と同じです。
WWW-Authenticate 応答ヘッダーからクライアント ID コンポーネントを取得して保存します。以降は、この値を 対象ユーザーのプリンシパル ID と呼びます。
サイトのレルムの取得¶
注釈
Cookie を使用している場合、Bearer レルムを含む WWW-Authenticate ヘッダーが返されないことがあります。この問題を回避するには、ブラウザーで Cookie を削除するか、Postman Interceptor を使用します。
認可コードの取得
以下のように認可 URL を作成します。
https://<tenant_name>.sharepoint.com/_layouts/15/OAuthAuthorize.aspx?client_id=<client_id>&scope=AllSites.Read&response_type=code&redirect_uri=<redirect_uri>
接続データに合わせて URL のパラメータを変更します。client_id には、Azure ポータルでのアプリケーション登録時の アプリケーション (クライアント) ID を使用します (これは、前の手順で取得したクライアント ID とは異なり、対象ユーザーのプリンシパル ID として使用されます)。
注釈
この手順では、Azure ポータルのユーザーに、アプリへの権限付与の承諾に必要な権限が必要です。前のサンプル URL では、すべての SharePoint サイトに対する読み取り権限をリクエストしています。この場合、リクエストされたリソースに対する 管理権限 が必要です。
特定のサイトに限定したリクエストを行うには、個々のサイトに対する読み取り権限をリクエストする、以下のような URL を使用できます。
https://<tenant_name>.sharepoint.com/sites/<sitename>/_layouts/15/OAuthAuthorize.aspx?client_id=<client_id>&scope=Site.Read&response_type=code&redirect_uri=<redirect_uri>
ブラウザーから URL に移動します。サイトにログインしていない場合は、ログインします。同意のページが開き、アプリがリクエストする権限の許可 (または拒否) が求められます。
アプリへの権限の付与¶
Once you grant the permission (by clicking Trust it), the SharePoint Online site asks the Access Control Service (ACS) to create a short-lived (approximately 5 minutes) authorization code unique to this combination of user and app. ACS sends the authorization code to the SharePoint site.
SharePoint Online サイトは、アプリの登録時に指定されたリダイレクト URI にブラウザーをリダイレクトします。認可コードもクエリ文字列として含まれます。リダイレクト URL は以下のように構成されます。http://localhost:9090/oauth/2.0/redirectURL.jsp/?**code=<authcode>** または https://<hostname>:9443/oauth/2.0/redirectURL.jsp/?**code=<authcode>**
アクセストークンと更新トークンの取得
以下の POST リクエストを作成します。
URL:
https://accounts.accesscontrol.windows.net/<tenant_id>/tokens/OAuth/2
ヘッダー:
Content-Type = "application/x-www-form-urlencoded"
POST パラメータ (リクエストの本文):
grant_type=authorization_code
client_id=<client_id>@<tenant_id>
client_secret=<client_secret>
code=<auth_code>
redirect_uri=<redirect_uri>
resource=<audience_principal_ID>/<tenant_name>.sharepoint.com@<tenant_id>
この場合
<tenant_id> は、「サイトのレルムの取得」手順で取得した Bearer レルムです。
<client_id> は <client id when registering the app>@<tenant_id from the step “Get the Realm of the site> です。
<client_secret> は、アプリ登録時に取得した client_secret です。
<auth_code> は、「認可コードの取得」手順で取得した認可コードです。
<resource> は <audience principal ID>/<sharepoint domain>@<tenant_id> です。
<redirect_uri> は、アプリ登録時に設定したリダイレクト URL です。
<audience_principal_ID> は、SharePoint の永続的なセキュリティプリンシパル ID です。<audience_principal_ID> は、「サイトのレルムの取得」手順で取得されます (応答ヘッダー WWW-Authenticate の値 “client_id”)。
注釈
すべての値を URL エンコードする必要があります (client_secret を含む)。
アーティファクトのインポート¶
これで、OData 向け SharePoint ウィザードの使用に必要なデータがすべて揃いました。[File] メニュー > [New] > [Data source] をクリックして、[Microsoft SharePoint for OData] を選択します。

OData 向け Microsoft SharePoint ウィザード¶
以下のパラメータを入力します。
Database: SharePoint のデータソースとビューが作成されるデータベースの名前。
View name prefix: VDP ビューを SharePoint Online サイトに関連付けるために作成されたすべてのビューの名前の接頭辞。このパラメータは最長で 10 文字です。
SharePoint Online service name: OAuth 2.0 の VDP ウィザードで生成されるアクセストークン。
Realm: 前の手順で取得されたレルム。
Audience principal id: 前の手順で取得されたクライアント ID の値。
Client ID: Azure アプリの登録時に生成されたクライアント ID。
Client Secret: Azure アプリの登録時に生成されたクライアントシークレット。
Access token: 前の手順で生成されたアクセストークン。
Refresh token: 前の手順で生成された更新トークン。
Site name: OData エンティティを取得する特定の SharePoint Online サイトのサイト名。
ここで [Execute import] をクリックして、SharePoint にクエリを実行するためのデータソースとビューを作成します。
注釈
作成されたビューは読み取り専用です。
注釈
以下の例では、 site2 を [View name prefix] 構成パラメータの値として使用しています。

作成された SharePoint のデータソースとビュー¶