// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models.WindowsUpdates;
using Microsoft.Kiota.Abstractions.Serialization;
var requestBody = new ContentApproval
{
OdataType = "#microsoft.graph.windowsUpdates.contentApproval",
Content = new CatalogContent
{
OdataType = "#microsoft.graph.windowsUpdates.catalogContent",
CatalogEntry = new FeatureUpdateCatalogEntry
{
OdataType = "#microsoft.graph.windowsUpdates.featureUpdateCatalogEntry",
Id = "6b7e60db-a8e4-426a-9aed-bd12b5c0b9d4",
},
},
DeploymentSettings = new DeploymentSettings
{
},
AdditionalData = new Dictionary<string, object>
{
{
"schedule" , new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"startDateTime", new UntypedString("String (timestamp)")
},
{
"gradualRollout", new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"@odata.type", new UntypedString("#microsoft.graph.windowsUpdates.dateDrivenRolloutSettings")
},
{
"endDateTime", new UntypedString("String (timestamp)")
},
})
},
})
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Admin.Windows.Updates.UpdatePolicies["{updatePolicy-id}"].ComplianceChanges.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.models.windowsupdates.ContentApproval complianceChange = new com.microsoft.graph.beta.models.windowsupdates.ContentApproval();
complianceChange.setOdataType("#microsoft.graph.windowsUpdates.contentApproval");
com.microsoft.graph.beta.models.windowsupdates.CatalogContent content = new com.microsoft.graph.beta.models.windowsupdates.CatalogContent();
content.setOdataType("#microsoft.graph.windowsUpdates.catalogContent");
com.microsoft.graph.beta.models.windowsupdates.FeatureUpdateCatalogEntry catalogEntry = new com.microsoft.graph.beta.models.windowsupdates.FeatureUpdateCatalogEntry();
catalogEntry.setOdataType("#microsoft.graph.windowsUpdates.featureUpdateCatalogEntry");
catalogEntry.setId("6b7e60db-a8e4-426a-9aed-bd12b5c0b9d4");
content.setCatalogEntry(catalogEntry);
complianceChange.setContent(content);
com.microsoft.graph.beta.models.windowsupdates.DeploymentSettings deploymentSettings = new com.microsoft.graph.beta.models.windowsupdates.DeploymentSettings();
complianceChange.setDeploymentSettings(deploymentSettings);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
schedule = new ();
schedule.setStartDateTime("String (timestamp)");
gradualRollout = new ();
gradualRollout.setOdataType("#microsoft.graph.windowsUpdates.dateDrivenRolloutSettings");
gradualRollout.setEndDateTime("String (timestamp)");
schedule.setGradualRollout(gradualRollout);
additionalData.put("schedule", schedule);
complianceChange.setAdditionalData(additionalData);
com.microsoft.graph.models.windowsupdates.ComplianceChange result = graphClient.admin().windows().updates().updatePolicies().byUpdatePolicyId("{updatePolicy-id}").complianceChanges().post(complianceChange);