创建 connectedOrganization
命名空间:microsoft.graph
创建新的 connectedOrganization 对象。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限。
| 权限类型 |
权限(从最低特权到最高特权) |
| 委派(工作或学校帐户) |
EntitlementManagement.ReadWrite.All |
| 委派(个人 Microsoft 帐户) |
不支持。 |
| 应用程序 |
EntitlementManagement.ReadWrite.All |
HTTP 请求
POST /identityGovernance/entitlementManagement/connectedOrganizations
| 名称 |
说明 |
| Authorization |
Bearer {token}。必需。 |
| Content-Type |
application/json. Required. |
请求正文
在请求正文中,提供 connectedOrganization 对象的 JSON 表示形式。
可以在创建 connectedOrganization 时指定以下属性。
| 属性 |
类型 |
说明 |
| displayName |
String |
连接的组织名称。 |
| 说明 |
String |
已连接的组织说明。 |
| identitySources |
identitySource 集合 |
包含一个元素的集合,即此连接组织中的初始标识源。 |
| state |
connectedOrganizationState |
已连接组织的状态定义具有请求者作用域类型的分配策略 AllConfiguredConnectedOrganizationSubjects 是否适用。 可取值为:configured、proposed。 |
响应
如果成功,此方法在响应 201 Created 正文中返回 响应代码和新的 connectedOrganization 对象。
示例
请求
POST https://graph.microsoft.com/v1.0/identityGovernance/entitlementManagement/connectedOrganizations/
Content-Type: application/json
{
"displayName":"Connected organization name",
"description":"Connected organization description",
"identitySources": [
{
"@odata.type": "#microsoft.graph.domainIdentitySource",
"domainName": "example.com",
"displayName": "example.com"
}
],
"state":"proposed"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var connectedOrganization = new ConnectedOrganization
{
DisplayName = "Connected organization name",
Description = "Connected organization description",
IdentitySources = new List<IdentitySource>()
{
new DomainIdentitySource
{
DomainName = "example.com",
DisplayName = "example.com"
}
},
State = ConnectedOrganizationState.Proposed
};
await graphClient.IdentityGovernance.EntitlementManagement.ConnectedOrganizations
.Request()
.AddAsync(connectedOrganization);
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
const connectedOrganization = {
displayName: 'Connected organization name',
description: 'Connected organization description',
identitySources: [
{
'@odata.type': '#microsoft.graph.domainIdentitySource',
domainName: 'example.com',
displayName: 'example.com'
}
],
state: 'proposed'
};
await client.api('/identityGovernance/entitlementManagement/connectedOrganizations/')
.post(connectedOrganization);
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/identityGovernance/entitlementManagement/connectedOrganizations/"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphConnectedOrganization *connectedOrganization = [[MSGraphConnectedOrganization alloc] init];
[connectedOrganization setDisplayName:@"Connected organization name"];
[connectedOrganization setDescription:@"Connected organization description"];
NSMutableArray *identitySourcesList = [[NSMutableArray alloc] init];
MSGraphIdentitySource *identitySources = [[MSGraphIdentitySource alloc] init];
[identitySources setDomainName:@"example.com"];
[identitySources setDisplayName:@"example.com"];
[identitySourcesList addObject: identitySources];
[connectedOrganization setIdentitySources:identitySourcesList];
[connectedOrganization setState: [MSGraphConnectedOrganizationState proposed]];
NSError *error;
NSData *connectedOrganizationData = [connectedOrganization getSerializedDataWithError:&error];
[urlRequest setHTTPBody:connectedOrganizationData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
ConnectedOrganization connectedOrganization = new ConnectedOrganization();
connectedOrganization.displayName = "Connected organization name";
connectedOrganization.description = "Connected organization description";
LinkedList<IdentitySource> identitySourcesList = new LinkedList<IdentitySource>();
DomainIdentitySource identitySources = new DomainIdentitySource();
identitySources.domainName = "example.com";
identitySources.displayName = "example.com";
identitySourcesList.add(identitySources);
connectedOrganization.identitySources = identitySourcesList;
connectedOrganization.state = ConnectedOrganizationState.PROPOSED;
graphClient.identityGovernance().entitlementManagement().connectedOrganizations()
.buildRequest()
.post(connectedOrganization);
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewConnectedOrganization()
displayName := "Connected organization name"
requestBody.SetDisplayName(&displayName)
description := "Connected organization description"
requestBody.SetDescription(&description)
requestBody.SetIdentitySources( []IdentitySource {
msgraphsdk.NewIdentitySource(),
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.domainIdentitySource",
"domainName": "example.com",
"displayName": "example.com",
}
}
state := "proposed"
requestBody.SetState(&state)
result, err := graphClient.IdentityGovernance().EntitlementManagement().ConnectedOrganizations().Post(requestBody)
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.Identity.Governance
$params = @{
DisplayName = "Connected organization name"
Description = "Connected organization description"
IdentitySources = @(
@{
"@odata.type" = "#microsoft.graph.domainIdentitySource"
DomainName = "example.com"
DisplayName = "example.com"
}
)
State = "proposed"
}
New-MgEntitlementManagementConnectedOrganization -BodyParameter $params
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
响应
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 201 Created
Content-type: application/json
{
"id": "35ff48a8-e9d8-4405-8425-0b23694287a4",
"displayName": "Connected organization name",
"description": "Connected organization description",
"createdDateTime": "2021-11-10T01:13:15.541617Z",
"modifiedDateTime": "2021-11-10T01:13:15.541617Z",
"state": "proposed",
"identitySources": []
}