创建 noncustodialDataSource
命名空间:microsoft.graph.ediscovery
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
创建新的 noncustodialDataSource 对象。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限。
| 权限类型 |
权限(从最低特权到最高特权) |
| 委派(工作或学校帐户) |
eDiscovery.Read.All、eDiscovery.ReadWrite.All |
| 委派(个人 Microsoft 帐户) |
不支持。 |
| 应用程序 |
不支持。 |
HTTP 请求
POST /compliance/ediscovery/cases/{caseId}/noncustodialDataSources
| 名称 |
说明 |
| Authorization |
Bearer {token}。必需。 |
| Content-Type |
application/json. Required. |
请求正文
在请求正文中,提供 noncustodialDataSource 对象的 JSON 表示形式。
下表显示创建 noncustodialDataSource时所需的属性。
| 属性 |
类型 |
说明 |
| applyHoldToSource |
布尔 |
指示是否将保留应用于非 (数据源,如邮箱或网站) 。 |
| datasource |
microsoft.graph.ediscovery.dataSource |
userSource 或 siteSource。 对于 userSource,请使用"dataSource" : { "@odata.type" : "microsoft.graph.ediscovery.userSource", "email" : "SMTP address"}。 对于网站源,请使用"dataSource" : { "@odata.type" : "microsoft.graph.ediscovery.siteSource", "site@odata.bind" : "siteId" },其中 siteId 可以派生自网站 URL,例如 https://contoso.sharepoint.com/sites/HumanResources ,Microsoft Graph 请求为 https://graph.microsoft.com/v1.0/sites/contoso.sharepoint.com:/sites/HumanResources 。 ID 是 ID 字段中列出的第一个 GUID。 |
响应
如果成功,此方法在响应正文中返回 响应代码和非 201 Created custodialDataSource 对象。
示例
示例 1:使用电子邮件添加非邮件数据源用户或组邮箱
请求
POST https://graph.microsoft.com/beta/compliance/ediscovery/cases/5b840b94-f821-4c4a-8cad-3a90062bf51a/noncustodialDataSources
Content-Type: application/json
{
"applyHoldToSource" : true,
"dataSource" : {
"@odata.type" : "microsoft.graph.ediscovery.userSource",
"email" : "adelev@contoso.com"
}
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var noncustodialDataSource = new Microsoft.Graph.Ediscovery.NoncustodialDataSource
{
ApplyHoldToSource = true,
DataSource = new UserSource
{
Email = "adelev@contoso.com"
}
};
await graphClient.Compliance.Ediscovery.Cases["{ediscovery.case-id}"].NoncustodialDataSources
.Request()
.AddAsync(noncustodialDataSource);
const options = {
authProvider,
};
const client = Client.init(options);
const noncustodialDataSource = {
applyHoldToSource: true,
dataSource: {
'@odata.type': 'microsoft.graph.ediscovery.userSource',
email: 'adelev@contoso.com'
}
};
await client.api('/compliance/ediscovery/cases/5b840b94-f821-4c4a-8cad-3a90062bf51a/noncustodialDataSources')
.version('beta')
.post(noncustodialDataSource);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/compliance/ediscovery/cases/5b840b94-f821-4c4a-8cad-3a90062bf51a/noncustodialDataSources"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphEdiscoveryNoncustodialDataSource *noncustodialDataSource = [[MSGraphEdiscoveryNoncustodialDataSource alloc] init];
[noncustodialDataSource setApplyHoldToSource: true];
MSGraphEdiscoveryDataSource *dataSource = [[MSGraphEdiscoveryDataSource alloc] init];
[dataSource setEmail:@"adelev@contoso.com"];
[noncustodialDataSource setDataSource:dataSource];
NSError *error;
NSData *noncustodialDataSourceData = [noncustodialDataSource getSerializedDataWithError:&error];
[urlRequest setHTTPBody:noncustodialDataSourceData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
NoncustodialDataSource noncustodialDataSource = new NoncustodialDataSource();
noncustodialDataSource.applyHoldToSource = true;
UserSource dataSource = new UserSource();
dataSource.email = "adelev@contoso.com";
noncustodialDataSource.dataSource = dataSource;
graphClient.compliance().ediscovery().cases("5b840b94-f821-4c4a-8cad-3a90062bf51a").noncustodialDataSources()
.buildRequest()
.post(noncustodialDataSource);
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewNoncustodialDataSource()
applyHoldToSource := true
requestBody.SetApplyHoldToSource(&applyHoldToSource)
dataSource := msgraphsdk.NewDataSource()
requestBody.SetDataSource(dataSource)
dataSource.SetAdditionalData(map[string]interface{}{
"@odata.type": "microsoft.graph.ediscovery.userSource",
"email": "adelev@contoso.com",
}
caseId := "case-id"
result, err := graphClient.Compliance().Ediscovery().CasesById(&caseId).NoncustodialDataSources().Post(requestBody)
Import-Module Microsoft.Graph.Compliance
$params = @{
ApplyHoldToSource = $true
DataSource = @{
"@odata.type" = "microsoft.graph.ediscovery.userSource"
Email = "adelev@contoso.com"
}
}
New-MgComplianceEdiscoveryCaseNoncustodialDataSource -CaseId $caseId -BodyParameter $params
响应
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#compliance/ediscovery/cases('5b840b94-f821-4c4a-8cad-3a90062bf51a')/noncustodialDataSources/$entity",
"status": "0",
"lastModifiedDateTime": "2021-02-19T07:02:45.7732516Z",
"releasedDateTime": "0001-01-01T00:00:00Z",
"id": "39374346363831303741353341373443",
"displayName": null,
"createdDateTime": "2021-02-19T07:02:45.4863718Z",
"applyHoldToSource": true
}
示例 2:添加具有 URL 的非托管数据源网站
请求
POST https://graph.microsoft.com/beta/compliance/ediscovery/cases/15d80234-8320-4f10-96d0-d98d53ffdfc9/noncustodialdatasources
Content-Type: application/json
{
"applyHoldToSource": false,
"dataSource": {
"@odata.type": "microsoft.graph.ediscovery.siteSource",
"site": {
"webUrl": "https://contoso.sharepoint.com/sites/SecretSite"
}
}
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var noncustodialDataSource = new Microsoft.Graph.Ediscovery.NoncustodialDataSource
{
ApplyHoldToSource = false,
DataSource = new SiteSource
{
Site = new Site
{
WebUrl = "https://contoso.sharepoint.com/sites/SecretSite"
}
}
};
await graphClient.Compliance.Ediscovery.Cases["{ediscovery.case-id}"].NoncustodialDataSources
.Request()
.AddAsync(noncustodialDataSource);
const options = {
authProvider,
};
const client = Client.init(options);
const noncustodialDataSource = {
applyHoldToSource: false,
dataSource: {
'@odata.type': 'microsoft.graph.ediscovery.siteSource',
site: {
webUrl: 'https://contoso.sharepoint.com/sites/SecretSite'
}
}
};
await client.api('/compliance/ediscovery/cases/15d80234-8320-4f10-96d0-d98d53ffdfc9/noncustodialdatasources')
.version('beta')
.post(noncustodialDataSource);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/compliance/ediscovery/cases/15d80234-8320-4f10-96d0-d98d53ffdfc9/noncustodialdatasources"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphEdiscoveryNoncustodialDataSource *noncustodialDataSource = [[MSGraphEdiscoveryNoncustodialDataSource alloc] init];
[noncustodialDataSource setApplyHoldToSource: false];
MSGraphEdiscoveryDataSource *dataSource = [[MSGraphEdiscoveryDataSource alloc] init];
MSGraphSite *site = [[MSGraphSite alloc] init];
[site setWebUrl:@"https://contoso.sharepoint.com/sites/SecretSite"];
[dataSource setSite:site];
[noncustodialDataSource setDataSource:dataSource];
NSError *error;
NSData *noncustodialDataSourceData = [noncustodialDataSource getSerializedDataWithError:&error];
[urlRequest setHTTPBody:noncustodialDataSourceData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
NoncustodialDataSource noncustodialDataSource = new NoncustodialDataSource();
noncustodialDataSource.applyHoldToSource = false;
SiteSource dataSource = new SiteSource();
Site site = new Site();
site.webUrl = "https://contoso.sharepoint.com/sites/SecretSite";
dataSource.site = site;
noncustodialDataSource.dataSource = dataSource;
graphClient.compliance().ediscovery().cases("15d80234-8320-4f10-96d0-d98d53ffdfc9").noncustodialDataSources()
.buildRequest()
.post(noncustodialDataSource);
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewNoncustodialDataSource()
applyHoldToSource := false
requestBody.SetApplyHoldToSource(&applyHoldToSource)
dataSource := msgraphsdk.NewDataSource()
requestBody.SetDataSource(dataSource)
dataSource.SetAdditionalData(map[string]interface{}{
"@odata.type": "microsoft.graph.ediscovery.siteSource",
}
caseId := "case-id"
result, err := graphClient.Compliance().Ediscovery().CasesById(&caseId).NoncustodialDataSources().Post(requestBody)
Import-Module Microsoft.Graph.Compliance
$params = @{
ApplyHoldToSource = $false
DataSource = @{
"@odata.type" = "microsoft.graph.ediscovery.siteSource"
}
}
New-MgComplianceEdiscoveryCaseNoncustodialDataSource -CaseId $caseId -BodyParameter $params
响应
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#compliance/ediscovery/cases('15d80234-8320-4f10-96d0-d98d53ffdfc9')/noncustodialDataSources/$entity",
"status": "Active",
"lastModifiedDateTime": "2021-08-11T22:43:45.1079425Z",
"releasedDateTime": "0001-01-01T00:00:00Z",
"id": "35393843394546413031353146334134",
"displayName": "Secret Site",
"createdDateTime": "2021-08-11T22:43:45.0189955Z",
"applyHoldToSource": false
}