Пространство имен: microsoft.graph
Создайте файлStorageContainerType в арендаторе-владельце. Количество типов контейнеров в клиенте ограничено.
Важно!
- Клиенту должно принадлежать приложение, назначенное в качестве владельца fileStorageContainerType (owningAppId).
- Регистрация типа контейнера в только что созданном клиенте может завершиться ошибкой, если клиент еще не полностью готов. Возможно, потребуется подождать не менее часа, прежде чем можно будет зарегистрировать тип контейнера в новом клиенте.
Этот API доступен в следующих национальных облачных развертываниях.
| Глобальная служба |
Правительство США L4 |
Правительство США L5 (DOD) |
Китай управляется 21Vianet |
| ✅ |
✅ |
✅ |
✅ |
Разрешения
Выберите разрешение или разрешения, помеченные как наименее привилегированные для этого API. Используйте более привилегированное разрешение или разрешения только в том случае, если это требуется приложению. Дополнительные сведения о делегированных разрешениях и разрешениях приложений см. в разделе Типы разрешений. Дополнительные сведения об этих разрешениях см. в справочнике по разрешениям.
| Тип разрешения |
Разрешения с наименьшими привилегиями |
Более высокие привилегированные разрешения |
| Делегированные (рабочая или учебная учетная запись) |
FileStorageContainerType.Manage.All |
Недоступно. |
| Делегированные (личная учетная запись Майкрософт) |
Не поддерживается. |
Не поддерживается. |
| Для приложений |
Не поддерживается. |
Не поддерживается. |
Примечание: Для вызова этого API требуется роль администратора SharePoint Embedded или глобальный администратор.
HTTP-запрос
POST /storage/fileStorage/containerTypes
Текст запроса
В тексте запроса укажите представление объекта fileStorageContainerType в формате JSON.
При создании fileStorageContainerType можно указать следующие свойства.
| Свойство |
Тип |
Описание |
| billingClassification |
fileStorageContainerBillingClassification |
Тип выставления счетов. Допустимые значения: standard, trial, directToCustomer, unknownFutureValue. Значение по умолчанию — standard. Необязательный параметр. |
| name |
String |
Имя fileStorageContainerType. Обязательно. |
| owningAppId |
GUID |
Идентификатор приложения, которому принадлежит fileStorageContainerType. Обязательно. |
| settings |
fileStorageContainerTypeSettings |
Параметры fileStorageContainerType. Необязательный параметр. |
Отклик
В случае успешного выполнения этот метод возвращает код отклика 201 Created и объект fileStorageContainerType в теле отклика.
Примеры
Запрос
В следующем примере показано, как создать пробный файлStorageContainerType.
POST https://graph.microsoft.com/v1.0/storage/fileStorage/containerTypes
Content-Type: application/json
{
"name": "Test Trial Container",
"owningAppId": "11335700-9a00-4c00-84dd-0c210f203f00",
"billingClassification": "trial",
"settings": {
"isItemVersioningEnabled": true,
"isSharingRestricted": false,
"consumingTenantOverridables": "isSearchEnabled,itemMajorVersionLimit",
"agent": {
"chatEmbedAllowedHosts": ["https://localhost:3000"]
}
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
using Microsoft.Kiota.Abstractions.Serialization;
var requestBody = new FileStorageContainerType
{
Name = "Test Trial Container",
OwningAppId = Guid.Parse("11335700-9a00-4c00-84dd-0c210f203f00"),
BillingClassification = FileStorageContainerBillingClassification.Trial,
Settings = new FileStorageContainerTypeSettings
{
IsItemVersioningEnabled = true,
IsSharingRestricted = false,
ConsumingTenantOverridables = FileStorageContainerTypeSettingsOverride.IsSearchEnabled | FileStorageContainerTypeSettingsOverride.ItemMajorVersionLimit,
AdditionalData = new Dictionary<string, object>
{
{
"agent" , new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"chatEmbedAllowedHosts", new UntypedArray(new List<UntypedNode>
{
new UntypedString("https://localhost:3000"),
})
},
})
},
},
},
};
// 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.PostAsync(requestBody);
Подробнее о том, как добавить SDK в свой проект и создать экземпляр authProvider, см. в документации по SDK.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
"github.com/google/uuid"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewFileStorageContainerType()
name := "Test Trial Container"
requestBody.SetName(&name)
owningAppId := uuid.MustParse("11335700-9a00-4c00-84dd-0c210f203f00")
requestBody.SetOwningAppId(&owningAppId)
billingClassification := graphmodels.TRIAL_FILESTORAGECONTAINERBILLINGCLASSIFICATION
requestBody.SetBillingClassification(&billingClassification)
settings := graphmodels.NewFileStorageContainerTypeSettings()
isItemVersioningEnabled := true
settings.SetIsItemVersioningEnabled(&isItemVersioningEnabled)
isSharingRestricted := false
settings.SetIsSharingRestricted(&isSharingRestricted)
consumingTenantOverridables := graphmodels.ISSEARCHENABLED,ITEMMAJORVERSIONLIMIT_FILESTORAGECONTAINERTYPESETTINGSOVERRIDE
settings.SetConsumingTenantOverridables(&consumingTenantOverridables)
additionalData := map[string]interface{}{
agent := graph.New()
chatEmbedAllowedHosts := []string {
"https://localhost:3000",
}
agent.SetChatEmbedAllowedHosts(chatEmbedAllowedHosts)
settings.SetAgent(agent)
}
settings.SetAdditionalData(additionalData)
requestBody.SetSettings(settings)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
containerTypes, err := graphClient.Storage().FileStorage().ContainerTypes().Post(context.Background(), requestBody, nil)
Подробнее о том, как добавить SDK в свой проект и создать экземпляр authProvider, см. в документации по SDK.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
FileStorageContainerType fileStorageContainerType = new FileStorageContainerType();
fileStorageContainerType.setName("Test Trial Container");
fileStorageContainerType.setOwningAppId(UUID.fromString("11335700-9a00-4c00-84dd-0c210f203f00"));
fileStorageContainerType.setBillingClassification(FileStorageContainerBillingClassification.Trial);
FileStorageContainerTypeSettings settings = new FileStorageContainerTypeSettings();
settings.setIsItemVersioningEnabled(true);
settings.setIsSharingRestricted(false);
settings.setConsumingTenantOverridables(EnumSet.of(FileStorageContainerTypeSettingsOverride.IsSearchEnabled, FileStorageContainerTypeSettingsOverride.ItemMajorVersionLimit));
HashMap<String, Object> additionalData = new HashMap<String, Object>();
agent = new ();
LinkedList<String> chatEmbedAllowedHosts = new LinkedList<String>();
chatEmbedAllowedHosts.add("https://localhost:3000");
agent.setChatEmbedAllowedHosts(chatEmbedAllowedHosts);
additionalData.put("agent", agent);
settings.setAdditionalData(additionalData);
fileStorageContainerType.setSettings(settings);
FileStorageContainerType result = graphClient.storage().fileStorage().containerTypes().post(fileStorageContainerType);
Подробнее о том, как добавить SDK в свой проект и создать экземпляр authProvider, см. в документации по SDK.
const options = {
authProvider,
};
const client = Client.init(options);
const fileStorageContainerType = {
name: 'Test Trial Container',
owningAppId: '11335700-9a00-4c00-84dd-0c210f203f00',
billingClassification: 'trial',
settings: {
isItemVersioningEnabled: true,
isSharingRestricted: false,
consumingTenantOverridables: 'isSearchEnabled,itemMajorVersionLimit',
agent: {
chatEmbedAllowedHosts: ['https://localhost:3000']
}
}
};
await client.api('/storage/fileStorage/containerTypes')
.post(fileStorageContainerType);
Подробнее о том, как добавить SDK в свой проект и создать экземпляр authProvider, см. в документации по SDK.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\FileStorageContainerType;
use Microsoft\Graph\Generated\Models\FileStorageContainerBillingClassification;
use Microsoft\Graph\Generated\Models\FileStorageContainerTypeSettings;
use Microsoft\Graph\Generated\Models\FileStorageContainerTypeSettingsOverride;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new FileStorageContainerType();
$requestBody->setName('Test Trial Container');
$requestBody->setOwningAppId('11335700-9a00-4c00-84dd-0c210f203f00');
$requestBody->setBillingClassification(new FileStorageContainerBillingClassification('trial'));
$settings = new FileStorageContainerTypeSettings();
$settings->setIsItemVersioningEnabled(true);
$settings->setIsSharingRestricted(false);
$settings->setConsumingTenantOverridables(new FileStorageContainerTypeSettingsOverride('isSearchEnabled,itemMajorVersionLimit'));
$additionalData = [
'agent' => [
'chatEmbedAllowedHosts' => [
'https://localhost:3000', ],
],
];
$settings->setAdditionalData($additionalData);
$requestBody->setSettings($settings);
$result = $graphServiceClient->storage()->fileStorage()->containerTypes()->post($requestBody)->wait();
Подробнее о том, как добавить SDK в свой проект и создать экземпляр authProvider, см. в документации по SDK.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.file_storage_container_type import FileStorageContainerType
from msgraph.generated.models.file_storage_container_billing_classification import FileStorageContainerBillingClassification
from msgraph.generated.models.file_storage_container_type_settings import FileStorageContainerTypeSettings
from msgraph.generated.models.file_storage_container_type_settings_override import FileStorageContainerTypeSettingsOverride
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = FileStorageContainerType(
name = "Test Trial Container",
owning_app_id = UUID("11335700-9a00-4c00-84dd-0c210f203f00"),
billing_classification = FileStorageContainerBillingClassification.Trial,
settings = FileStorageContainerTypeSettings(
is_item_versioning_enabled = True,
is_sharing_restricted = False,
consuming_tenant_overridables = FileStorageContainerTypeSettingsOverride.IsSearchEnabled | FileStorageContainerTypeSettingsOverride.ItemMajorVersionLimit,
additional_data = {
"agent" : {
"chat_embed_allowed_hosts" : [
"https://localhost:3000",
],
},
}
),
)
result = await graph_client.storage.file_storage.container_types.post(request_body)
Подробнее о том, как добавить SDK в свой проект и создать экземпляр authProvider, см. в документации по SDK.
Отклик
Ниже показан пример отклика.
Примечание. Объект отклика, показанный здесь, может быть сокращен для удобочитаемости.
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.fileStorageContainerType",
"id": "de988700-d700-020e-0a00-0831f3042f00",
"name": "Test Trial Container",
"owningAppId": "11335700-9a00-4c00-84dd-0c210f203f00",
"billingClassification": "trial",
"billingStatus": "valid",
"createdDateTime": "01/20/2025",
"expirationDateTime": "02/20/2025",
"etag": "RVRhZw==",
"settings": {
"urlTemplate": "",
"isDiscoverabilityEnabled": true,
"isSearchEnabled": true,
"isItemVersioningEnabled": true,
"itemMajorVersionLimit": 50,
"maxStoragePerContainerInBytes": 104857600,
"isSharingRestricted": false,
"consumingTenantOverridables": "isSearchEnabled,itemMajorVersionLimit",
"agent": {
"chatEmbedAllowedHosts": ["https://localhost:3000"]
}
}
}