名前空間: microsoft.graph
重要
Microsoft Graph の /beta バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
この アクセス許可 を fileStorageContainerType に追加するユーザーアクセス許可オブジェクトを作成します。 既存の所有者 (コンテナーの種類のアクセス許可コレクションにownerロールを持つユーザー)、SharePoint Embedded Administrators、またはグローバル管理者のみがアクセス許可を追加できます。
次の制約が適用されます。
- コンテナーの種類ごとに最大 3 つの アクセス許可が許可されます。 4 番目のアクセス許可を追加すると、
400 Bad Request エラーが返されます。
- 重複するアクセス許可はべき等として扱われます。 指定したユーザーがコンテナーの種類に対するアクセス許可を既に持っている場合、サービスは変更を加えず、新しいアクセス許可が作成されていない場合でも、応答本文の既存のアクセス許可リソースを
201 Created 状態で返します。
- 現在、
owner ロールのみがサポートされています。
注:
- ゲスト ユーザーは、コンテナーの種類のアクセス許可の受信者にすることはできません。
- ゲスト ユーザーはこの操作を実行できません。
この API は、次の国内クラウド展開で使用できます。
| グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
| ✅ |
❌ |
❌ |
❌ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
| アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
| 委任 (職場または学校のアカウント) |
FileStorageContainerType.Manage.All |
注意事項なし。 |
| 委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
| アプリケーション |
サポートされていません。 |
サポートされていません。 |
HTTP 要求
POST /storage/fileStorage/containerTypes/{fileStorageContainerTypeId}/permissions
| 名前 |
説明 |
| Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
| Content-Type |
application/json. 必須です。 |
要求本文
要求本文で、 アクセス許可 オブジェクトの JSON 表現を指定します。
アクセス許可を作成するときに、次のプロパティを指定できます。
| プロパティ |
型 |
説明 |
| grantedToV2 |
sharePointIdentitySet |
アクセス許可を付与するユーザーの ID。
ユーザーの ID を持つ user プロパティのみがサポートされています。グループ ID とアプリケーション ID はサポートされていません。 必須です。 |
| roles |
文字列コレクション |
ユーザーに付与されるロール。 現在、 owner のみがサポートされています。 必須です。 |
応答
成功した場合、このメソッドは応答コード 201 Created と応答本文の アクセス許可 オブジェクトを返します。
要求がコンテナーの種類ごとに 3 つのアクセス許可の制限を超えた場合、このメソッドは 400 Bad Request 応答コードを返します。
例
要求
次の例は、コンテナーの種類に所有者アクセス許可を追加する要求を示しています。
POST https://graph.microsoft.com/beta/storage/fileStorage/containerTypes/de988700-d700-020e-0a00-0831f3042f00/permissions
Content-Type: application/json
{
"roles": ["owner"],
"grantedToV2": {
"user": {
"id": "11111111-1111-1111-1111-111111111111"
}
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Permission
{
Roles = new List<string>
{
"owner",
},
GrantedToV2 = new SharePointIdentitySet
{
User = new Identity
{
Id = "11111111-1111-1111-1111-111111111111",
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Storage.FileStorage.ContainerTypes["{fileStorageContainerType-id}"].Permissions.PostAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewPermission()
roles := []string {
"owner",
}
requestBody.SetRoles(roles)
grantedToV2 := graphmodels.NewSharePointIdentitySet()
user := graphmodels.NewIdentity()
id := "11111111-1111-1111-1111-111111111111"
user.SetId(&id)
grantedToV2.SetUser(user)
requestBody.SetGrantedToV2(grantedToV2)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
permissions, err := graphClient.Storage().FileStorage().ContainerTypes().ByFileStorageContainerTypeId("fileStorageContainerType-id").Permissions().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Permission permission = new Permission();
LinkedList<String> roles = new LinkedList<String>();
roles.add("owner");
permission.setRoles(roles);
SharePointIdentitySet grantedToV2 = new SharePointIdentitySet();
Identity user = new Identity();
user.setId("11111111-1111-1111-1111-111111111111");
grantedToV2.setUser(user);
permission.setGrantedToV2(grantedToV2);
Permission result = graphClient.storage().fileStorage().containerTypes().byFileStorageContainerTypeId("{fileStorageContainerType-id}").permissions().post(permission);
const options = {
authProvider,
};
const client = Client.init(options);
const permission = {
roles: ['owner'],
grantedToV2: {
user: {
id: '11111111-1111-1111-1111-111111111111'
}
}
};
await client.api('/storage/fileStorage/containerTypes/de988700-d700-020e-0a00-0831f3042f00/permissions')
.version('beta')
.post(permission);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Permission;
use Microsoft\Graph\Beta\Generated\Models\SharePointIdentitySet;
use Microsoft\Graph\Beta\Generated\Models\Identity;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Permission();
$requestBody->setRoles(['owner', ]);
$grantedToV2 = new SharePointIdentitySet();
$grantedToV2User = new Identity();
$grantedToV2User->setId('11111111-1111-1111-1111-111111111111');
$grantedToV2->setUser($grantedToV2User);
$requestBody->setGrantedToV2($grantedToV2);
$result = $graphServiceClient->storage()->fileStorage()->containerTypes()->byFileStorageContainerTypeId('fileStorageContainerType-id')->permissions()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.permission import Permission
from msgraph_beta.generated.models.share_point_identity_set import SharePointIdentitySet
from msgraph_beta.generated.models.identity import Identity
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Permission(
roles = [
"owner",
],
granted_to_v2 = SharePointIdentitySet(
user = Identity(
id = "11111111-1111-1111-1111-111111111111",
),
),
)
result = await graph_client.storage.file_storage.container_types.by_file_storage_container_type_id('fileStorageContainerType-id').permissions.post(request_body)
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.permission",
"id": "b3duZXJfMTExMTExMTEtMTExMS0xMTExLTExMTEtMTExMTExMTExMTEx",
"roles": ["owner"],
"grantedToV2": {
"user": {
"id": "11111111-1111-1111-1111-111111111111"
}
}
}