名前空間: microsoft.graph
重要
Microsoft Graph の /beta
バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
注意
このバージョンのアクセス レビュー API は非推奨となり、2023 年 5 月 19 日にデータの返しを停止します。
アクセス レビュー API を使用してください。
Microsoft Entraアクセス レビュー機能で、新しいプログラム オブジェクトを作成します。
この API は、次の国内クラウド展開で使用できます。
グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
✅ |
✅ |
✅ |
✅ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「 アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、 アクセス許可のリファレンスを参照してください。
アクセス許可の種類 |
最小特権アクセス許可 |
特権の高いアクセス許可 |
委任 (職場または学校のアカウント) |
ProgramControl.ReadWrite.All |
注意事項なし。 |
委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
アプリケーション |
サポートされていません。 |
サポートされていません。 |
サインインしているユーザーは、プログラムの作成を許可するディレクトリ ロールにも存在する必要があります。
HTTP 要求
POST /programs
名前 |
型 |
説明 |
Authorization |
string |
ベアラー {token}。 必須です。 |
要求本文
要求本文で、 プログラム オブジェクトの JSON 表現を指定します。
次の表は、プログラムを作成するときに必要なプロパティを示しています。
プロパティ |
型 |
説明 |
displayName |
String |
プログラムの名前。 |
description |
String |
プログラムの説明。 |
応答
成功した場合、このメソッドは 201, Created
応答コードと応答本文の プログラム オブジェクトを返します。
例
要求
要求本文で、 プログラム オブジェクトの JSON 表現を指定します。
POST https://graph.microsoft.com/beta/programs
Content-type: application/json
{
"displayName": "testprogram3",
"description": "test description"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Program
{
DisplayName = "testprogram3",
Description = "test description",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Programs.PostAsync(requestBody);
mgc-beta programs create --body '{\
"displayName": "testprogram3",\
"description": "test description"\
}\
'
// 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.NewProgram()
displayName := "testprogram3"
requestBody.SetDisplayName(&displayName)
description := "test description"
requestBody.SetDescription(&description)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
programs, err := graphClient.Programs().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Program program = new Program();
program.setDisplayName("testprogram3");
program.setDescription("test description");
Program result = graphClient.programs().post(program);
const options = {
authProvider,
};
const client = Client.init(options);
const program = {
displayName: 'testprogram3',
description: 'test description'
};
await client.api('/programs')
.version('beta')
.post(program);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Program;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Program();
$requestBody->setDisplayName('testprogram3');
$requestBody->setDescription('test description');
$result = $graphServiceClient->programs()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.Governance
$params = @{
displayName = "testprogram3"
description = "test description"
}
New-MgBetaProgram -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.program import Program
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Program(
display_name = "testprogram3",
description = "test description",
)
result = await graph_client.programs.post(request_body)
応答
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 201 Created
Content-type: application/json
{
"id": "7e59d237-2fb0-4e5d-b7bb-d4f9f9129213",
"displayName": "testprogram3",
"description": "test description"
}
関連コンテンツ