updatableAssetGroup:addMembers
命名空间:microsoft.graph.windowsUpdates
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
将成员添加到 updatableAssetGroup。
可以将 azureADDevice 资源添加为成员,但不能将 updatableAssetGroup 资源添加为成员。
将Azure AD设备添加为可更新资源组的成员会自动创建 azureADDevice 对象(如果该对象不存在)。
您还可以使用 addMembersById 方法添加成员。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限。
| 权限类型 |
权限(从最低特权到最高特权) |
| 委派(工作或学校帐户) |
WindowsUpdates.ReadWrite.All |
| 委派(个人 Microsoft 帐户) |
不支持。 |
| 应用程序 |
WindowsUpdates.ReadWrite.All |
HTTP 请求
POST /admin/windows/updates/updatableAssets/{updatableAssetGroupId}/addMembers
| 名称 |
说明 |
| Authorization |
Bearer {token}。必需。 |
| Content-Type |
application/json. Required. |
请求正文
在请求正文中,提供参数的 JSON 表示形式。
下表显示了可用于此操作的参数。
响应
如果成功,此操作返回 202 Accepted 响应代码。 它不会在响应正文中返回任何内容。
示例
请求
POST https://graph.microsoft.com/beta/admin/windows/updates/updatableAssets/{updatableAssetGroupId}/addMembers
Content-Type: application/json
{
"assets": [
{
"@odata.type": "#microsoft.graph.windowsUpdates.azureADDevice",
"id": "String (identifier)"
}
]
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var assets = new List<Microsoft.Graph.WindowsUpdates.UpdatableAsset>()
{
new Microsoft.Graph.WindowsUpdates.AzureADDevice
{
Id = "String (identifier)"
}
};
await graphClient.Admin.Windows.Updates.UpdatableAssets["{windowsUpdates.updatableAsset-id}"]
.AddMembers(assets)
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
const addMembers = {
assets: [
{
'@odata.type': '#microsoft.graph.windowsUpdates.azureADDevice',
id: 'String (identifier)'
}
]
};
await client.api('/admin/windows/updates/updatableAssets/{updatableAssetGroupId}/addMembers')
.version('beta')
.post(addMembers);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/admin/windows/updates/updatableAssets/{updatableAssetGroupId}/addMembers"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
NSMutableArray *assetsList = [[NSMutableArray alloc] init];
MSGraphWindowsUpdatesUpdatableAsset *assets = [[MSGraphWindowsUpdatesUpdatableAsset alloc] init];
[assets setId:@"String (identifier)"];
[assetsList addObject: assets];
payloadDictionary[@"assets"] = assetsList;
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();
LinkedList<UpdatableAsset> assetsList = new LinkedList<UpdatableAsset>();
AzureADDevice assets = new AzureADDevice();
assets.id = "String (identifier)";
assetsList.add(assets);
UpdatableAssetCollectionResponse updatableAssetCollectionResponse = new UpdatableAssetCollectionResponse();
updatableAssetCollectionResponse.value = assetsList;
UpdatableAssetCollectionPage updatableAssetCollectionPage = new UpdatableAssetCollectionPage(updatableAssetCollectionResponse, null);
graphClient.admin().windows().updates().updatableAssets("{updatableAssetGroupId}")
.addMembers(UpdatableAssetAddMembersParameterSet
.newBuilder()
.withAssets(assetsList)
.build())
.buildRequest()
.post();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewAssetsRequestBody()
requestBody.SetAssets( []UpdatableAsset {
msgraphsdk.NewUpdatableAsset(),
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.windowsUpdates.azureADDevice",
"id": "String (identifier)",
}
}
updatableAssetId := "updatableAsset-id"
graphClient.Admin().Windows().Updates().UpdatableAssetsById(&updatableAssetId).AddMembers(updatableAsset-id).Post(requestBody)
Import-Module Microsoft.Graph.WindowsUpdates
$params = @{
Assets = @(
@{
"@odata.type" = "#microsoft.graph.windowsUpdates.azureADDevice"
Id = "String (identifier)"
}
)
}
Add-MgWindowsUpdatesUpdatableAssetMember -UpdatableAssetId $updatableAssetId -BodyParameter $params
响应
HTTP/1.1 202 Accepted