创建保管人
命名空间:microsoft.graph.ediscovery
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
创建新的保管 人 对象。 创建保管人对象后,你需要创建保管人的用户来源,以引用其邮箱和OneDrive for Business网站。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限。
| 权限类型 |
权限(从最低特权到最高特权) |
| 委派(工作或学校帐户) |
eDiscovery.Read.All、eDiscovery.ReadWrite.All |
| 委派(个人 Microsoft 帐户) |
不支持。 |
| 应用程序 |
不支持。 |
HTTP 请求
POST /compliance/ediscovery/cases/{caseId}/custodians
| 名称 |
说明 |
| Authorization |
Bearer {token}。必需。 |
| Content-Type |
application/json. Required. |
请求正文
在请求正文中,提供保管人对象的 JSON 表示 形式。
下表显示创建保管人 时所需的 属性。
| 属性 |
类型 |
Description |
| email |
String |
保管人的主 SMTP 地址。 必需。 |
| applyHoldToSources |
布尔 |
指示是否将保留应用于保管人的来源 (邮箱、网站或Teams) 。 |
响应
如果成功,此方法在响应正文中返回 响应代码和 201 Created microsoft.graph.ediscovery.custodian 对象。
示例
请求
POST https://graph.microsoft.com/beta/compliance/ediscovery/cases/2192ca408ea2410eba3bec8ae873be6b/custodians
Content-Type: application/json
{
"email":"AdeleV@contoso.com",
"applyHoldToSources":"true"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var custodian = new Microsoft.Graph.Ediscovery.Custodian
{
Email = "AdeleV@contoso.com",
ApplyHoldToSources = true
};
await graphClient.Compliance.Ediscovery.Cases["{ediscovery.case-id}"].Custodians
.Request()
.AddAsync(custodian);
const options = {
authProvider,
};
const client = Client.init(options);
const custodian = {
email: 'AdeleV@contoso.com',
applyHoldToSources: 'true'
};
await client.api('/compliance/ediscovery/cases/2192ca408ea2410eba3bec8ae873be6b/custodians')
.version('beta')
.post(custodian);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/compliance/ediscovery/cases/2192ca408ea2410eba3bec8ae873be6b/custodians"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphEdiscoveryCustodian *custodian = [[MSGraphEdiscoveryCustodian alloc] init];
[custodian setEmail:@"AdeleV@contoso.com"];
[custodian setApplyHoldToSources:@"true"];
NSError *error;
NSData *custodianData = [custodian getSerializedDataWithError:&error];
[urlRequest setHTTPBody:custodianData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
Custodian custodian = new Custodian();
custodian.email = "AdeleV@contoso.com";
custodian.applyHoldToSources = false;
graphClient.compliance().ediscovery().cases("2192ca408ea2410eba3bec8ae873be6b").custodians()
.buildRequest()
.post(custodian);
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewCustodian()
email := "AdeleV@contoso.com"
requestBody.SetEmail(&email)
applyHoldToSources := "true"
requestBody.SetApplyHoldToSources(&applyHoldToSources)
caseId := "case-id"
result, err := graphClient.Compliance().Ediscovery().CasesById(&caseId).Custodians().Post(requestBody)
Import-Module Microsoft.Graph.Compliance
$params = @{
Email = "AdeleV@contoso.com"
ApplyHoldToSources = "true"
}
New-MgComplianceEdiscoveryCaseCustodian -CaseId $caseId -BodyParameter $params
响应
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#compliance/ediscovery/cases('4c8f8f70-7785-4bd4-b296-c98376a2c5e1')/custodians/$entity",
"email": "AdeleV@contoso.com",
"applyHoldToSources": false,
"status": "active",
"createdDateTime": "2020-10-30T20:47:01.7724531Z",
"lastModifiedDateTime": "2020-10-30T20:47:02.2512381Z",
"releasedDateTime": null,
"acknowledgedDateTime": null,
"id": "45353243323138344430413038363846",
"displayName": "Adele Vance"
}