创建保管人 siteSource
本文内容
命名空间:microsoft.graph.ediscovery
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
创建新的保管人 siteSource 对象。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
eDiscovery.Read.All、eDiscovery.ReadWrite.All
委派(个人 Microsoft 帐户)
不支持。
应用程序
不支持。
HTTP 请求
POST /compliance/ediscovery/cases/{caseId}/custodians/{custodianId}/siteSources
名称
说明
Authorization
Bearer {token}。必需。
Content-Type
application/json. Required.
请求正文
在请求正文中,提供 siteSource 对象的 JSON 表示形式。
下表显示创建 siteSource 时所需的属性。
属性
类型
说明
网站
String
网站的 URL;例如, https://contoso.sharepoint.com/sites/HumanResources 。
响应
如果成功,此方法在响应正文中返回 响应代码和 201 Created microsoft.graph.ediscovery.siteSource 对象。
示例
请求
POST https://graph.microsoft.com/beta/compliance/ediscovery/cases/15d80234-8320-4f10-96d0-d98d53ffdfc9/custodians/8904528fef4d4578b44f71a80188f400/siteSources
Content-Type: application/json
{
"site": {
"webUrl": "https://contoso.sharepoint.com/sites/HumanResources"
}
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var siteSource = new Microsoft.Graph.Ediscovery.SiteSource
{
Site = new Site
{
WebUrl = "https://contoso.sharepoint.com/sites/HumanResources"
}
};
await graphClient.Compliance.Ediscovery.Cases["{ediscovery.case-id}"].Custodians["{ediscovery.custodian-id}"].SiteSources
.Request()
.AddAsync(siteSource);
const options = {
authProvider,
};
const client = Client.init(options);
const siteSource = {
site: {
webUrl: 'https://contoso.sharepoint.com/sites/HumanResources'
}
};
await client.api('/compliance/ediscovery/cases/15d80234-8320-4f10-96d0-d98d53ffdfc9/custodians/8904528fef4d4578b44f71a80188f400/siteSources')
.version('beta')
.post(siteSource);
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/custodians/8904528fef4d4578b44f71a80188f400/siteSources"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphEdiscoverySiteSource *siteSource = [[MSGraphEdiscoverySiteSource alloc] init];
MSGraphSite *site = [[MSGraphSite alloc] init];
[site setWebUrl:@"https://contoso.sharepoint.com/sites/HumanResources"];
[siteSource setSite:site];
NSError *error;
NSData *siteSourceData = [siteSource getSerializedDataWithError:&error];
[urlRequest setHTTPBody:siteSourceData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
SiteSource siteSource = new SiteSource();
Site site = new Site();
site.webUrl = "https://contoso.sharepoint.com/sites/HumanResources";
siteSource.site = site;
graphClient.compliance().ediscovery().cases("15d80234-8320-4f10-96d0-d98d53ffdfc9").custodians("8904528fef4d4578b44f71a80188f400").siteSources()
.buildRequest()
.post(siteSource);
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewSiteSource()
site := msgraphsdk.NewSite()
requestBody.SetSite(site)
webUrl := "https://contoso.sharepoint.com/sites/HumanResources"
site.SetWebUrl(&webUrl)
caseId := "case-id"
custodianId := "custodian-id"
result, err := graphClient.Compliance().Ediscovery().CasesById(&caseId).CustodiansById(&custodianId).SiteSources().Post(requestBody)
Import-Module Microsoft.Graph.Compliance
$params = @{
Site = @{
WebUrl = "https://contoso.sharepoint.com/sites/HumanResources"
}
}
New-MgComplianceEdiscoveryCaseCustodianSiteSource -CaseId $caseId -CustodianId $custodianId -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')/custodians('8904528fef4d4578b44f71a80188f400')/siteSources/$entity",
"@odata.id": "https://graph.microsoft.com/v1.0/sites/2493b4eb-1a48-4cac-b0d0-aad05e6b9df0",
"displayName": "Human resources site",
"createdDateTime": "2021-08-10T18:25:48.6441363Z",
"id": "42393244-3838-4636-3437-453030334136",
"createdBy": {
"user": {
"id": "798d8d23-2087-4e03-912e-c0d9db5cb5d2",
"displayName": null
}
}
}