deploymentAudience:updateAudienceById
本文内容
命名空间:microsoft.graph.windowsUpdates
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
使用相同类型的 updatableAsset 资源更新 deploymentAudience 的成员和排除集合。
将 azureADDevice 添加到部署访问群体的成员或排除集合会自动创建Azure AD对象(如果该对象不存在)。
如果 deploymentAudience 的排除项和成员集合中包含相同的 updatableAsset ,则部署不会应用于该资产。
您还可以使用 updateAudience 方法来更新 deploymentAudience 。
备注
此 API 具有 与 通过 Intune 创建的部署相关的已知问题。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
WindowsUpdates.ReadWrite.All
委派(个人 Microsoft 帐户)
不支持。
应用程序
WindowsUpdates.ReadWrite.All
HTTP 请求
POST /admin/windows/updates/deployments/{deploymentId}/audience/updateAudienceById
名称
说明
Authorization
Bearer {token}。必需。
Content-Type
application/json. Required.
请求正文
在请求正文中,提供参数的 JSON 表示形式。
下表显示了可用于此操作的参数。
参数
类型
说明
memberEntityType
字符串
可更新资源的完整类型。 可取值为:#microsoft.graph.windowsUpdates.azureADDevice、#microsoft.graph.windowsUpdates.updatableAssetGroup。
addMembers
String 集合
与要添加为部署访问群体成员的可更新资产相对应的标识符列表。
removeMembers
字符串集合
与要作为部署访问群体成员删除的可更新资源相对应的标识符列表。
addExclusions
字符串集合
与要作为部署访问群体排除项添加的可更新资源相对应的标识符列表。
removeExclusions
字符串集合
与要作为部署访问群体排除项删除的可更新资源相对应的标识符列表。
响应
如果成功,此操作返回 202 Accepted 响应代码。 它不会在响应正文中返回任何内容。
示例
请求
POST https://graph.microsoft.com/beta/admin/windows/updates/deployments/{deploymentId}/audience/updateAudienceById
Content-Type: application/json
{
"memberEntityType": "String",
"addMembers": [
"String"
],
"removeMembers": [
"String"
],
"addExclusions": [
"String"
],
"removeExclusions": [
"String"
]
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var memberEntityType = "String";
var addMembers = new List<String>()
{
"String"
};
var removeMembers = new List<String>()
{
"String"
};
var addExclusions = new List<String>()
{
"String"
};
var removeExclusions = new List<String>()
{
"String"
};
await graphClient.Admin.Windows.Updates.Deployments["{windowsUpdates.deployment-id}"].Audience
.UpdateAudienceById(memberEntityType,addMembers,removeMembers,addExclusions,removeExclusions)
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
const updateAudienceById = {
memberEntityType: 'String',
addMembers: [
'String'
],
removeMembers: [
'String'
],
addExclusions: [
'String'
],
removeExclusions: [
'String'
]
};
await client.api('/admin/windows/updates/deployments/{deploymentId}/audience/updateAudienceById')
.version('beta')
.post(updateAudienceById);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/admin/windows/updates/deployments/{deploymentId}/audience/updateAudienceById"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
NSString *memberEntityType = @"String";
payloadDictionary[@"memberEntityType"] = memberEntityType;
NSMutableArray *addMembersList = [[NSMutableArray alloc] init];
[addMembersList addObject: @"String"];
payloadDictionary[@"addMembers"] = addMembersList;
NSMutableArray *removeMembersList = [[NSMutableArray alloc] init];
[removeMembersList addObject: @"String"];
payloadDictionary[@"removeMembers"] = removeMembersList;
NSMutableArray *addExclusionsList = [[NSMutableArray alloc] init];
[addExclusionsList addObject: @"String"];
payloadDictionary[@"addExclusions"] = addExclusionsList;
NSMutableArray *removeExclusionsList = [[NSMutableArray alloc] init];
[removeExclusionsList addObject: @"String"];
payloadDictionary[@"removeExclusions"] = removeExclusionsList;
NSData *data = [NSJSONSerialization dataWithJSONObject:payloadDictionary options:kNilOptions error:&error];
[urlRequest setHTTPBody:data];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
String memberEntityType = "String";
LinkedList<String> addMembersList = new LinkedList<String>();
addMembersList.add("String");
LinkedList<String> removeMembersList = new LinkedList<String>();
removeMembersList.add("String");
LinkedList<String> addExclusionsList = new LinkedList<String>();
addExclusionsList.add("String");
LinkedList<String> removeExclusionsList = new LinkedList<String>();
removeExclusionsList.add("String");
graphClient.admin().windows().updates().deployments("{deploymentId}").audience()
.updateAudienceById(DeploymentAudienceUpdateAudienceByIdParameterSet
.newBuilder()
.withMemberEntityType(memberEntityType)
.withAddMembers(addMembersList)
.withRemoveMembers(removeMembersList)
.withAddExclusions(addExclusionsList)
.withRemoveExclusions(removeExclusionsList)
.build())
.buildRequest()
.post();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.New()
memberEntityType := "String"
requestBody.SetMemberEntityType(&memberEntityType)
requestBody.SetAddMembers( []String {
"String",
}
requestBody.SetRemoveMembers( []String {
"String",
}
requestBody.SetAddExclusions( []String {
"String",
}
requestBody.SetRemoveExclusions( []String {
"String",
}
deploymentId := "deployment-id"
graphClient.Admin().Windows().Updates().DeploymentsById(&deploymentId).Audience().UpdateAudienceById(deployment-id).Post(requestBody)
Import-Module Microsoft.Graph.WindowsUpdates
$params = @{
MemberEntityType = "String"
AddMembers = @(
"String"
)
RemoveMembers = @(
"String"
)
AddExclusions = @(
"String"
)
RemoveExclusions = @(
"String"
)
}
Update-MgWindowsUpdatesDeploymentAudienceById -DeploymentId $deploymentId -BodyParameter $params
响应
HTTP/1.1 202 Accepted