Namespace: microsoft.graph
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Create a column for a fileStorageContainer that specifies a columnDefinition.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
✅ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type |
Least privileged permission |
Higher privileged permissions |
Delegated (work or school account) |
FileStorageContainer.Selected |
Not supported. |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
FileStorageContainer.Selected |
Not supported. |
Note
In addition to Microsoft Graph permissions, your app must have the necessary container type-level permission or permissions to call this API. For more information, see container types. To learn more about container type-level permissions, see SharePoint Embedded authorization.
HTTP request
POST /storage/fileStorage/containers/{containerId}/columns
Request body
In the request body, supply a JSON representation of the columnDefinition object.
Only the following type-related properties are supported and they're mutually exclusive; a column can only have one of them specified at a time.
Response
If successful, this method returns a 201 Created
response code and a columnDefinition object in the response body.
Examples
Request
The following example shows a request.
POST https://graph.microsoft.com/beta/storage/fileStorage/containers/b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z/columns
Content-Type: application/json
{
"description": "test",
"enforceUniqueValues": false,
"hidden": false,
"indexed": false,
"name": "Title",
"text": {
"allowMultipleLines": false,
"appendChangesToExistingText": false,
"linesForEditing": 0,
"maxLength": 255
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new ColumnDefinition
{
Description = "test",
EnforceUniqueValues = false,
Hidden = false,
Indexed = false,
Name = "Title",
Text = new TextColumn
{
AllowMultipleLines = false,
AppendChangesToExistingText = false,
LinesForEditing = 0,
MaxLength = 255,
},
};
// 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.Containers["{fileStorageContainer-id}"].Columns.PostAsync(requestBody);
mgc-beta storage file-storage containers columns create --file-storage-container-id {fileStorageContainer-id} --body '{\
"description": "test",\
"enforceUniqueValues": false,\
"hidden": false,\
"indexed": false,\
"name": "Title",\
"text": {\
"allowMultipleLines": false,\
"appendChangesToExistingText": false,\
"linesForEditing": 0,\
"maxLength": 255\
}\
}\
'
// 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.NewColumnDefinition()
description := "test"
requestBody.SetDescription(&description)
enforceUniqueValues := false
requestBody.SetEnforceUniqueValues(&enforceUniqueValues)
hidden := false
requestBody.SetHidden(&hidden)
indexed := false
requestBody.SetIndexed(&indexed)
name := "Title"
requestBody.SetName(&name)
text := graphmodels.NewTextColumn()
allowMultipleLines := false
text.SetAllowMultipleLines(&allowMultipleLines)
appendChangesToExistingText := false
text.SetAppendChangesToExistingText(&appendChangesToExistingText)
linesForEditing := int32(0)
text.SetLinesForEditing(&linesForEditing)
maxLength := int32(255)
text.SetMaxLength(&maxLength)
requestBody.SetText(text)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
columns, err := graphClient.Storage().FileStorage().Containers().ByFileStorageContainerId("fileStorageContainer-id").Columns().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
ColumnDefinition columnDefinition = new ColumnDefinition();
columnDefinition.setDescription("test");
columnDefinition.setEnforceUniqueValues(false);
columnDefinition.setHidden(false);
columnDefinition.setIndexed(false);
columnDefinition.setName("Title");
TextColumn text = new TextColumn();
text.setAllowMultipleLines(false);
text.setAppendChangesToExistingText(false);
text.setLinesForEditing(0);
text.setMaxLength(255);
columnDefinition.setText(text);
ColumnDefinition result = graphClient.storage().fileStorage().containers().byFileStorageContainerId("{fileStorageContainer-id}").columns().post(columnDefinition);
const options = {
authProvider,
};
const client = Client.init(options);
const columnDefinition = {
description: 'test',
enforceUniqueValues: false,
hidden: false,
indexed: false,
name: 'Title',
text: {
allowMultipleLines: false,
appendChangesToExistingText: false,
linesForEditing: 0,
maxLength: 255
}
};
await client.api('/storage/fileStorage/containers/b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z/columns')
.version('beta')
.post(columnDefinition);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\ColumnDefinition;
use Microsoft\Graph\Beta\Generated\Models\TextColumn;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ColumnDefinition();
$requestBody->setDescription('test');
$requestBody->setEnforceUniqueValues(false);
$requestBody->setHidden(false);
$requestBody->setIndexed(false);
$requestBody->setName('Title');
$text = new TextColumn();
$text->setAllowMultipleLines(false);
$text->setAppendChangesToExistingText(false);
$text->setLinesForEditing(0);
$text->setMaxLength(255);
$requestBody->setText($text);
$result = $graphServiceClient->storage()->fileStorage()->containers()->byFileStorageContainerId('fileStorageContainer-id')->columns()->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.column_definition import ColumnDefinition
from msgraph_beta.generated.models.text_column import TextColumn
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ColumnDefinition(
description = "test",
enforce_unique_values = False,
hidden = False,
indexed = False,
name = "Title",
text = TextColumn(
allow_multiple_lines = False,
append_changes_to_existing_text = False,
lines_for_editing = 0,
max_length = 255,
),
)
result = await graph_client.storage.file_storage.containers.by_file_storage_container_id('fileStorageContainer-id').columns.post(request_body)
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-Type: application/json
{
"description": "test",
"displayName": "Title",
"enforceUniqueValues": false,
"hidden": false,
"id": "99ddcf45-e2f7-4f17-82b0-6fba34445103",
"indexed": false,
"name": "Title",
"text": {
"allowMultipleLines": false,
"appendChangesToExistingText": false,
"linesForEditing": 0,
"maxLength": 255
}
}