One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Here is an example of the request.
PATCH https://graph.microsoft.com/v1.0/deviceManagement
Content-type: application/json
Content-length: 2632
{
"@odata.type": "#microsoft.graph.deviceManagement",
"subscriptionState": "active",
"deviceProtectionOverview": {
"@odata.type": "microsoft.graph.deviceProtectionOverview",
"totalReportedDeviceCount": 8,
"inactiveThreatAgentDeviceCount": 14,
"unknownStateThreatAgentDeviceCount": 2,
"pendingSignatureUpdateDeviceCount": 1,
"cleanDeviceCount": 0,
"pendingFullScanDeviceCount": 10,
"pendingRestartDeviceCount": 9,
"pendingManualStepsDeviceCount": 13,
"pendingOfflineScanDeviceCount": 13,
"criticalFailuresDeviceCount": 11,
"pendingQuickScanDeviceCount": 11
},
"windowsMalwareOverview": {
"@odata.type": "microsoft.graph.windowsMalwareOverview",
"malwareDetectedDeviceCount": 10,
"totalMalwareCount": 1,
"totalDistinctMalwareCount": 9,
"malwareStateSummary": [
{
"@odata.type": "microsoft.graph.windowsMalwareStateCount",
"state": "actionFailed",
"deviceCount": 11,
"malwareDetectionCount": 5,
"distinctMalwareCount": 4,
"lastUpdateDateTime": "2016-12-31T23:58:21.6459442-08:00"
}
],
"malwareSeveritySummary": [
{
"@odata.type": "microsoft.graph.windowsMalwareSeverityCount",
"severity": "low",
"malwareDetectionCount": 5,
"distinctMalwareCount": 4,
"lastUpdateDateTime": "2016-12-31T23:58:21.6459442-08:00"
}
],
"malwareExecutionStateSummary": [
{
"@odata.type": "microsoft.graph.windowsMalwareExecutionStateCount",
"executionState": "blocked",
"deviceCount": 11,
"lastUpdateDateTime": "2016-12-31T23:58:21.6459442-08:00"
}
],
"malwareCategorySummary": [
{
"@odata.type": "microsoft.graph.windowsMalwareCategoryCount",
"category": "adware",
"deviceCount": 11,
"activeMalwareDetectionCount": 11,
"distinctActiveMalwareCount": 10,
"lastUpdateDateTime": "2016-12-31T23:58:21.6459442-08:00"
}
],
"malwareNameSummary": [
{
"@odata.type": "microsoft.graph.windowsMalwareNameCount",
"malwareIdentifier": "Malware Identifier value",
"name": "Name value",
"deviceCount": 11,
"lastUpdateDateTime": "2016-12-31T23:58:21.6459442-08:00"
}
],
"osVersionsSummary": [
{
"@odata.type": "microsoft.graph.osVersionCount",
"osVersion": "Os Version value",
"deviceCount": 11,
"lastUpdateDateTime": "2016-12-31T23:58:21.6459442-08:00"
}
]
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new DeviceManagement
{
OdataType = "#microsoft.graph.deviceManagement",
SubscriptionState = DeviceManagementSubscriptionState.Active,
DeviceProtectionOverview = new DeviceProtectionOverview
{
OdataType = "microsoft.graph.deviceProtectionOverview",
TotalReportedDeviceCount = 8,
InactiveThreatAgentDeviceCount = 14,
UnknownStateThreatAgentDeviceCount = 2,
PendingSignatureUpdateDeviceCount = 1,
CleanDeviceCount = 0,
PendingFullScanDeviceCount = 10,
PendingRestartDeviceCount = 9,
PendingManualStepsDeviceCount = 13,
PendingOfflineScanDeviceCount = 13,
CriticalFailuresDeviceCount = 11,
PendingQuickScanDeviceCount = 11,
},
WindowsMalwareOverview = new WindowsMalwareOverview
{
OdataType = "microsoft.graph.windowsMalwareOverview",
MalwareDetectedDeviceCount = 10,
TotalMalwareCount = 1,
TotalDistinctMalwareCount = 9,
MalwareStateSummary = new List<WindowsMalwareStateCount>
{
new WindowsMalwareStateCount
{
OdataType = "microsoft.graph.windowsMalwareStateCount",
State = WindowsMalwareThreatState.ActionFailed,
DeviceCount = 11,
MalwareDetectionCount = 5,
DistinctMalwareCount = 4,
LastUpdateDateTime = DateTimeOffset.Parse("2016-12-31T23:58:21.6459442-08:00"),
},
},
MalwareSeveritySummary = new List<WindowsMalwareSeverityCount>
{
new WindowsMalwareSeverityCount
{
OdataType = "microsoft.graph.windowsMalwareSeverityCount",
Severity = WindowsMalwareSeverity.Low,
MalwareDetectionCount = 5,
DistinctMalwareCount = 4,
LastUpdateDateTime = DateTimeOffset.Parse("2016-12-31T23:58:21.6459442-08:00"),
},
},
MalwareExecutionStateSummary = new List<WindowsMalwareExecutionStateCount>
{
new WindowsMalwareExecutionStateCount
{
OdataType = "microsoft.graph.windowsMalwareExecutionStateCount",
ExecutionState = WindowsMalwareExecutionState.Blocked,
DeviceCount = 11,
LastUpdateDateTime = DateTimeOffset.Parse("2016-12-31T23:58:21.6459442-08:00"),
},
},
MalwareCategorySummary = new List<WindowsMalwareCategoryCount>
{
new WindowsMalwareCategoryCount
{
OdataType = "microsoft.graph.windowsMalwareCategoryCount",
Category = WindowsMalwareCategory.Adware,
DeviceCount = 11,
ActiveMalwareDetectionCount = 11,
DistinctActiveMalwareCount = 10,
LastUpdateDateTime = DateTimeOffset.Parse("2016-12-31T23:58:21.6459442-08:00"),
},
},
MalwareNameSummary = new List<WindowsMalwareNameCount>
{
new WindowsMalwareNameCount
{
OdataType = "microsoft.graph.windowsMalwareNameCount",
MalwareIdentifier = "Malware Identifier value",
Name = "Name value",
DeviceCount = 11,
LastUpdateDateTime = DateTimeOffset.Parse("2016-12-31T23:58:21.6459442-08:00"),
},
},
OsVersionsSummary = new List<OsVersionCount>
{
new OsVersionCount
{
OdataType = "microsoft.graph.osVersionCount",
OsVersion = "Os Version value",
DeviceCount = 11,
LastUpdateDateTime = DateTimeOffset.Parse("2016-12-31T23:58:21.6459442-08:00"),
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceManagement.PatchAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc device-management patch --body '{\
"@odata.type": "#microsoft.graph.deviceManagement",\
"subscriptionState": "active",\
"deviceProtectionOverview": {\
"@odata.type": "microsoft.graph.deviceProtectionOverview",\
"totalReportedDeviceCount": 8,\
"inactiveThreatAgentDeviceCount": 14,\
"unknownStateThreatAgentDeviceCount": 2,\
"pendingSignatureUpdateDeviceCount": 1,\
"cleanDeviceCount": 0,\
"pendingFullScanDeviceCount": 10,\
"pendingRestartDeviceCount": 9,\
"pendingManualStepsDeviceCount": 13,\
"pendingOfflineScanDeviceCount": 13,\
"criticalFailuresDeviceCount": 11,\
"pendingQuickScanDeviceCount": 11\
},\
"windowsMalwareOverview": {\
"@odata.type": "microsoft.graph.windowsMalwareOverview",\
"malwareDetectedDeviceCount": 10,\
"totalMalwareCount": 1,\
"totalDistinctMalwareCount": 9,\
"malwareStateSummary": [\
{\
"@odata.type": "microsoft.graph.windowsMalwareStateCount",\
"state": "actionFailed",\
"deviceCount": 11,\
"malwareDetectionCount": 5,\
"distinctMalwareCount": 4,\
"lastUpdateDateTime": "2016-12-31T23:58:21.6459442-08:00"\
}\
],\
"malwareSeveritySummary": [\
{\
"@odata.type": "microsoft.graph.windowsMalwareSeverityCount",\
"severity": "low",\
"malwareDetectionCount": 5,\
"distinctMalwareCount": 4,\
"lastUpdateDateTime": "2016-12-31T23:58:21.6459442-08:00"\
}\
],\
"malwareExecutionStateSummary": [\
{\
"@odata.type": "microsoft.graph.windowsMalwareExecutionStateCount",\
"executionState": "blocked",\
"deviceCount": 11,\
"lastUpdateDateTime": "2016-12-31T23:58:21.6459442-08:00"\
}\
],\
"malwareCategorySummary": [\
{\
"@odata.type": "microsoft.graph.windowsMalwareCategoryCount",\
"category": "adware",\
"deviceCount": 11,\
"activeMalwareDetectionCount": 11,\
"distinctActiveMalwareCount": 10,\
"lastUpdateDateTime": "2016-12-31T23:58:21.6459442-08:00"\
}\
],\
"malwareNameSummary": [\
{\
"@odata.type": "microsoft.graph.windowsMalwareNameCount",\
"malwareIdentifier": "Malware Identifier value",\
"name": "Name value",\
"deviceCount": 11,\
"lastUpdateDateTime": "2016-12-31T23:58:21.6459442-08:00"\
}\
],\
"osVersionsSummary": [\
{\
"@odata.type": "microsoft.graph.osVersionCount",\
"osVersion": "Os Version value",\
"deviceCount": 11,\
"lastUpdateDateTime": "2016-12-31T23:58:21.6459442-08:00"\
}\
]\
}\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewDeviceManagement()
subscriptionState := graphmodels.ACTIVE_DEVICEMANAGEMENTSUBSCRIPTIONSTATE
requestBody.SetSubscriptionState(&subscriptionState)
deviceProtectionOverview := graphmodels.NewDeviceProtectionOverview()
totalReportedDeviceCount := int32(8)
deviceProtectionOverview.SetTotalReportedDeviceCount(&totalReportedDeviceCount)
inactiveThreatAgentDeviceCount := int32(14)
deviceProtectionOverview.SetInactiveThreatAgentDeviceCount(&inactiveThreatAgentDeviceCount)
unknownStateThreatAgentDeviceCount := int32(2)
deviceProtectionOverview.SetUnknownStateThreatAgentDeviceCount(&unknownStateThreatAgentDeviceCount)
pendingSignatureUpdateDeviceCount := int32(1)
deviceProtectionOverview.SetPendingSignatureUpdateDeviceCount(&pendingSignatureUpdateDeviceCount)
cleanDeviceCount := int32(0)
deviceProtectionOverview.SetCleanDeviceCount(&cleanDeviceCount)
pendingFullScanDeviceCount := int32(10)
deviceProtectionOverview.SetPendingFullScanDeviceCount(&pendingFullScanDeviceCount)
pendingRestartDeviceCount := int32(9)
deviceProtectionOverview.SetPendingRestartDeviceCount(&pendingRestartDeviceCount)
pendingManualStepsDeviceCount := int32(13)
deviceProtectionOverview.SetPendingManualStepsDeviceCount(&pendingManualStepsDeviceCount)
pendingOfflineScanDeviceCount := int32(13)
deviceProtectionOverview.SetPendingOfflineScanDeviceCount(&pendingOfflineScanDeviceCount)
criticalFailuresDeviceCount := int32(11)
deviceProtectionOverview.SetCriticalFailuresDeviceCount(&criticalFailuresDeviceCount)
pendingQuickScanDeviceCount := int32(11)
deviceProtectionOverview.SetPendingQuickScanDeviceCount(&pendingQuickScanDeviceCount)
requestBody.SetDeviceProtectionOverview(deviceProtectionOverview)
windowsMalwareOverview := graphmodels.NewWindowsMalwareOverview()
malwareDetectedDeviceCount := int32(10)
windowsMalwareOverview.SetMalwareDetectedDeviceCount(&malwareDetectedDeviceCount)
totalMalwareCount := int32(1)
windowsMalwareOverview.SetTotalMalwareCount(&totalMalwareCount)
totalDistinctMalwareCount := int32(9)
windowsMalwareOverview.SetTotalDistinctMalwareCount(&totalDistinctMalwareCount)
windowsMalwareStateCount := graphmodels.NewWindowsMalwareStateCount()
state := graphmodels.ACTIONFAILED_WINDOWSMALWARETHREATSTATE
windowsMalwareStateCount.SetState(&state)
deviceCount := int32(11)
windowsMalwareStateCount.SetDeviceCount(&deviceCount)
malwareDetectionCount := int32(5)
windowsMalwareStateCount.SetMalwareDetectionCount(&malwareDetectionCount)
distinctMalwareCount := int32(4)
windowsMalwareStateCount.SetDistinctMalwareCount(&distinctMalwareCount)
lastUpdateDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:58:21.6459442-08:00")
windowsMalwareStateCount.SetLastUpdateDateTime(&lastUpdateDateTime)
malwareStateSummary := []graphmodels.WindowsMalwareStateCountable {
windowsMalwareStateCount,
}
windowsMalwareOverview.SetMalwareStateSummary(malwareStateSummary)
windowsMalwareSeverityCount := graphmodels.NewWindowsMalwareSeverityCount()
severity := graphmodels.LOW_WINDOWSMALWARESEVERITY
windowsMalwareSeverityCount.SetSeverity(&severity)
malwareDetectionCount := int32(5)
windowsMalwareSeverityCount.SetMalwareDetectionCount(&malwareDetectionCount)
distinctMalwareCount := int32(4)
windowsMalwareSeverityCount.SetDistinctMalwareCount(&distinctMalwareCount)
lastUpdateDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:58:21.6459442-08:00")
windowsMalwareSeverityCount.SetLastUpdateDateTime(&lastUpdateDateTime)
malwareSeveritySummary := []graphmodels.WindowsMalwareSeverityCountable {
windowsMalwareSeverityCount,
}
windowsMalwareOverview.SetMalwareSeveritySummary(malwareSeveritySummary)
windowsMalwareExecutionStateCount := graphmodels.NewWindowsMalwareExecutionStateCount()
executionState := graphmodels.BLOCKED_WINDOWSMALWAREEXECUTIONSTATE
windowsMalwareExecutionStateCount.SetExecutionState(&executionState)
deviceCount := int32(11)
windowsMalwareExecutionStateCount.SetDeviceCount(&deviceCount)
lastUpdateDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:58:21.6459442-08:00")
windowsMalwareExecutionStateCount.SetLastUpdateDateTime(&lastUpdateDateTime)
malwareExecutionStateSummary := []graphmodels.WindowsMalwareExecutionStateCountable {
windowsMalwareExecutionStateCount,
}
windowsMalwareOverview.SetMalwareExecutionStateSummary(malwareExecutionStateSummary)
windowsMalwareCategoryCount := graphmodels.NewWindowsMalwareCategoryCount()
category := graphmodels.ADWARE_WINDOWSMALWARECATEGORY
windowsMalwareCategoryCount.SetCategory(&category)
deviceCount := int32(11)
windowsMalwareCategoryCount.SetDeviceCount(&deviceCount)
activeMalwareDetectionCount := int32(11)
windowsMalwareCategoryCount.SetActiveMalwareDetectionCount(&activeMalwareDetectionCount)
distinctActiveMalwareCount := int32(10)
windowsMalwareCategoryCount.SetDistinctActiveMalwareCount(&distinctActiveMalwareCount)
lastUpdateDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:58:21.6459442-08:00")
windowsMalwareCategoryCount.SetLastUpdateDateTime(&lastUpdateDateTime)
malwareCategorySummary := []graphmodels.WindowsMalwareCategoryCountable {
windowsMalwareCategoryCount,
}
windowsMalwareOverview.SetMalwareCategorySummary(malwareCategorySummary)
windowsMalwareNameCount := graphmodels.NewWindowsMalwareNameCount()
malwareIdentifier := "Malware Identifier value"
windowsMalwareNameCount.SetMalwareIdentifier(&malwareIdentifier)
name := "Name value"
windowsMalwareNameCount.SetName(&name)
deviceCount := int32(11)
windowsMalwareNameCount.SetDeviceCount(&deviceCount)
lastUpdateDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:58:21.6459442-08:00")
windowsMalwareNameCount.SetLastUpdateDateTime(&lastUpdateDateTime)
malwareNameSummary := []graphmodels.WindowsMalwareNameCountable {
windowsMalwareNameCount,
}
windowsMalwareOverview.SetMalwareNameSummary(malwareNameSummary)
osVersionCount := graphmodels.NewOsVersionCount()
osVersion := "Os Version value"
osVersionCount.SetOsVersion(&osVersion)
deviceCount := int32(11)
osVersionCount.SetDeviceCount(&deviceCount)
lastUpdateDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:58:21.6459442-08:00")
osVersionCount.SetLastUpdateDateTime(&lastUpdateDateTime)
osVersionsSummary := []graphmodels.OsVersionCountable {
osVersionCount,
}
windowsMalwareOverview.SetOsVersionsSummary(osVersionsSummary)
requestBody.SetWindowsMalwareOverview(windowsMalwareOverview)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
deviceManagement, err := graphClient.DeviceManagement().Patch(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
DeviceManagement deviceManagement = new DeviceManagement();
deviceManagement.setOdataType("#microsoft.graph.deviceManagement");
deviceManagement.setSubscriptionState(DeviceManagementSubscriptionState.Active);
DeviceProtectionOverview deviceProtectionOverview = new DeviceProtectionOverview();
deviceProtectionOverview.setOdataType("microsoft.graph.deviceProtectionOverview");
deviceProtectionOverview.setTotalReportedDeviceCount(8);
deviceProtectionOverview.setInactiveThreatAgentDeviceCount(14);
deviceProtectionOverview.setUnknownStateThreatAgentDeviceCount(2);
deviceProtectionOverview.setPendingSignatureUpdateDeviceCount(1);
deviceProtectionOverview.setCleanDeviceCount(0);
deviceProtectionOverview.setPendingFullScanDeviceCount(10);
deviceProtectionOverview.setPendingRestartDeviceCount(9);
deviceProtectionOverview.setPendingManualStepsDeviceCount(13);
deviceProtectionOverview.setPendingOfflineScanDeviceCount(13);
deviceProtectionOverview.setCriticalFailuresDeviceCount(11);
deviceProtectionOverview.setPendingQuickScanDeviceCount(11);
deviceManagement.setDeviceProtectionOverview(deviceProtectionOverview);
WindowsMalwareOverview windowsMalwareOverview = new WindowsMalwareOverview();
windowsMalwareOverview.setOdataType("microsoft.graph.windowsMalwareOverview");
windowsMalwareOverview.setMalwareDetectedDeviceCount(10);
windowsMalwareOverview.setTotalMalwareCount(1);
windowsMalwareOverview.setTotalDistinctMalwareCount(9);
LinkedList<WindowsMalwareStateCount> malwareStateSummary = new LinkedList<WindowsMalwareStateCount>();
WindowsMalwareStateCount windowsMalwareStateCount = new WindowsMalwareStateCount();
windowsMalwareStateCount.setOdataType("microsoft.graph.windowsMalwareStateCount");
windowsMalwareStateCount.setState(WindowsMalwareThreatState.ActionFailed);
windowsMalwareStateCount.setDeviceCount(11);
windowsMalwareStateCount.setMalwareDetectionCount(5);
windowsMalwareStateCount.setDistinctMalwareCount(4);
OffsetDateTime lastUpdateDateTime = OffsetDateTime.parse("2016-12-31T23:58:21.6459442-08:00");
windowsMalwareStateCount.setLastUpdateDateTime(lastUpdateDateTime);
malwareStateSummary.add(windowsMalwareStateCount);
windowsMalwareOverview.setMalwareStateSummary(malwareStateSummary);
LinkedList<WindowsMalwareSeverityCount> malwareSeveritySummary = new LinkedList<WindowsMalwareSeverityCount>();
WindowsMalwareSeverityCount windowsMalwareSeverityCount = new WindowsMalwareSeverityCount();
windowsMalwareSeverityCount.setOdataType("microsoft.graph.windowsMalwareSeverityCount");
windowsMalwareSeverityCount.setSeverity(WindowsMalwareSeverity.Low);
windowsMalwareSeverityCount.setMalwareDetectionCount(5);
windowsMalwareSeverityCount.setDistinctMalwareCount(4);
OffsetDateTime lastUpdateDateTime1 = OffsetDateTime.parse("2016-12-31T23:58:21.6459442-08:00");
windowsMalwareSeverityCount.setLastUpdateDateTime(lastUpdateDateTime1);
malwareSeveritySummary.add(windowsMalwareSeverityCount);
windowsMalwareOverview.setMalwareSeveritySummary(malwareSeveritySummary);
LinkedList<WindowsMalwareExecutionStateCount> malwareExecutionStateSummary = new LinkedList<WindowsMalwareExecutionStateCount>();
WindowsMalwareExecutionStateCount windowsMalwareExecutionStateCount = new WindowsMalwareExecutionStateCount();
windowsMalwareExecutionStateCount.setOdataType("microsoft.graph.windowsMalwareExecutionStateCount");
windowsMalwareExecutionStateCount.setExecutionState(WindowsMalwareExecutionState.Blocked);
windowsMalwareExecutionStateCount.setDeviceCount(11);
OffsetDateTime lastUpdateDateTime2 = OffsetDateTime.parse("2016-12-31T23:58:21.6459442-08:00");
windowsMalwareExecutionStateCount.setLastUpdateDateTime(lastUpdateDateTime2);
malwareExecutionStateSummary.add(windowsMalwareExecutionStateCount);
windowsMalwareOverview.setMalwareExecutionStateSummary(malwareExecutionStateSummary);
LinkedList<WindowsMalwareCategoryCount> malwareCategorySummary = new LinkedList<WindowsMalwareCategoryCount>();
WindowsMalwareCategoryCount windowsMalwareCategoryCount = new WindowsMalwareCategoryCount();
windowsMalwareCategoryCount.setOdataType("microsoft.graph.windowsMalwareCategoryCount");
windowsMalwareCategoryCount.setCategory(WindowsMalwareCategory.Adware);
windowsMalwareCategoryCount.setDeviceCount(11);
windowsMalwareCategoryCount.setActiveMalwareDetectionCount(11);
windowsMalwareCategoryCount.setDistinctActiveMalwareCount(10);
OffsetDateTime lastUpdateDateTime3 = OffsetDateTime.parse("2016-12-31T23:58:21.6459442-08:00");
windowsMalwareCategoryCount.setLastUpdateDateTime(lastUpdateDateTime3);
malwareCategorySummary.add(windowsMalwareCategoryCount);
windowsMalwareOverview.setMalwareCategorySummary(malwareCategorySummary);
LinkedList<WindowsMalwareNameCount> malwareNameSummary = new LinkedList<WindowsMalwareNameCount>();
WindowsMalwareNameCount windowsMalwareNameCount = new WindowsMalwareNameCount();
windowsMalwareNameCount.setOdataType("microsoft.graph.windowsMalwareNameCount");
windowsMalwareNameCount.setMalwareIdentifier("Malware Identifier value");
windowsMalwareNameCount.setName("Name value");
windowsMalwareNameCount.setDeviceCount(11);
OffsetDateTime lastUpdateDateTime4 = OffsetDateTime.parse("2016-12-31T23:58:21.6459442-08:00");
windowsMalwareNameCount.setLastUpdateDateTime(lastUpdateDateTime4);
malwareNameSummary.add(windowsMalwareNameCount);
windowsMalwareOverview.setMalwareNameSummary(malwareNameSummary);
LinkedList<OsVersionCount> osVersionsSummary = new LinkedList<OsVersionCount>();
OsVersionCount osVersionCount = new OsVersionCount();
osVersionCount.setOdataType("microsoft.graph.osVersionCount");
osVersionCount.setOsVersion("Os Version value");
osVersionCount.setDeviceCount(11);
OffsetDateTime lastUpdateDateTime5 = OffsetDateTime.parse("2016-12-31T23:58:21.6459442-08:00");
osVersionCount.setLastUpdateDateTime(lastUpdateDateTime5);
osVersionsSummary.add(osVersionCount);
windowsMalwareOverview.setOsVersionsSummary(osVersionsSummary);
deviceManagement.setWindowsMalwareOverview(windowsMalwareOverview);
DeviceManagement result = graphClient.deviceManagement().patch(deviceManagement);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const deviceManagement = {
'@odata.type': '#microsoft.graph.deviceManagement',
subscriptionState: 'active',
deviceProtectionOverview: {
'@odata.type': 'microsoft.graph.deviceProtectionOverview',
totalReportedDeviceCount: 8,
inactiveThreatAgentDeviceCount: 14,
unknownStateThreatAgentDeviceCount: 2,
pendingSignatureUpdateDeviceCount: 1,
cleanDeviceCount: 0,
pendingFullScanDeviceCount: 10,
pendingRestartDeviceCount: 9,
pendingManualStepsDeviceCount: 13,
pendingOfflineScanDeviceCount: 13,
criticalFailuresDeviceCount: 11,
pendingQuickScanDeviceCount: 11
},
windowsMalwareOverview: {
'@odata.type': 'microsoft.graph.windowsMalwareOverview',
malwareDetectedDeviceCount: 10,
totalMalwareCount: 1,
totalDistinctMalwareCount: 9,
malwareStateSummary: [
{
'@odata.type': 'microsoft.graph.windowsMalwareStateCount',
state: 'actionFailed',
deviceCount: 11,
malwareDetectionCount: 5,
distinctMalwareCount: 4,
lastUpdateDateTime: '2016-12-31T23:58:21.6459442-08:00'
}
],
malwareSeveritySummary: [
{
'@odata.type': 'microsoft.graph.windowsMalwareSeverityCount',
severity: 'low',
malwareDetectionCount: 5,
distinctMalwareCount: 4,
lastUpdateDateTime: '2016-12-31T23:58:21.6459442-08:00'
}
],
malwareExecutionStateSummary: [
{
'@odata.type': 'microsoft.graph.windowsMalwareExecutionStateCount',
executionState: 'blocked',
deviceCount: 11,
lastUpdateDateTime: '2016-12-31T23:58:21.6459442-08:00'
}
],
malwareCategorySummary: [
{
'@odata.type': 'microsoft.graph.windowsMalwareCategoryCount',
category: 'adware',
deviceCount: 11,
activeMalwareDetectionCount: 11,
distinctActiveMalwareCount: 10,
lastUpdateDateTime: '2016-12-31T23:58:21.6459442-08:00'
}
],
malwareNameSummary: [
{
'@odata.type': 'microsoft.graph.windowsMalwareNameCount',
malwareIdentifier: 'Malware Identifier value',
name: 'Name value',
deviceCount: 11,
lastUpdateDateTime: '2016-12-31T23:58:21.6459442-08:00'
}
],
osVersionsSummary: [
{
'@odata.type': 'microsoft.graph.osVersionCount',
osVersion: 'Os Version value',
deviceCount: 11,
lastUpdateDateTime: '2016-12-31T23:58:21.6459442-08:00'
}
]
}
};
await client.api('/deviceManagement')
.update(deviceManagement);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\DeviceManagement;
use Microsoft\Graph\Generated\Models\DeviceManagementSubscriptionState;
use Microsoft\Graph\Generated\Models\DeviceProtectionOverview;
use Microsoft\Graph\Generated\Models\WindowsMalwareOverview;
use Microsoft\Graph\Generated\Models\WindowsMalwareStateCount;
use Microsoft\Graph\Generated\Models\WindowsMalwareThreatState;
use Microsoft\Graph\Generated\Models\WindowsMalwareSeverityCount;
use Microsoft\Graph\Generated\Models\WindowsMalwareSeverity;
use Microsoft\Graph\Generated\Models\WindowsMalwareExecutionStateCount;
use Microsoft\Graph\Generated\Models\WindowsMalwareExecutionState;
use Microsoft\Graph\Generated\Models\WindowsMalwareCategoryCount;
use Microsoft\Graph\Generated\Models\WindowsMalwareCategory;
use Microsoft\Graph\Generated\Models\WindowsMalwareNameCount;
use Microsoft\Graph\Generated\Models\OsVersionCount;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DeviceManagement();
$requestBody->setOdataType('#microsoft.graph.deviceManagement');
$requestBody->setSubscriptionState(new DeviceManagementSubscriptionState('active'));
$deviceProtectionOverview = new DeviceProtectionOverview();
$deviceProtectionOverview->setOdataType('microsoft.graph.deviceProtectionOverview');
$deviceProtectionOverview->setTotalReportedDeviceCount(8);
$deviceProtectionOverview->setInactiveThreatAgentDeviceCount(14);
$deviceProtectionOverview->setUnknownStateThreatAgentDeviceCount(2);
$deviceProtectionOverview->setPendingSignatureUpdateDeviceCount(1);
$deviceProtectionOverview->setCleanDeviceCount(0);
$deviceProtectionOverview->setPendingFullScanDeviceCount(10);
$deviceProtectionOverview->setPendingRestartDeviceCount(9);
$deviceProtectionOverview->setPendingManualStepsDeviceCount(13);
$deviceProtectionOverview->setPendingOfflineScanDeviceCount(13);
$deviceProtectionOverview->setCriticalFailuresDeviceCount(11);
$deviceProtectionOverview->setPendingQuickScanDeviceCount(11);
$requestBody->setDeviceProtectionOverview($deviceProtectionOverview);
$windowsMalwareOverview = new WindowsMalwareOverview();
$windowsMalwareOverview->setOdataType('microsoft.graph.windowsMalwareOverview');
$windowsMalwareOverview->setMalwareDetectedDeviceCount(10);
$windowsMalwareOverview->setTotalMalwareCount(1);
$windowsMalwareOverview->setTotalDistinctMalwareCount(9);
$malwareStateSummaryWindowsMalwareStateCount1 = new WindowsMalwareStateCount();
$malwareStateSummaryWindowsMalwareStateCount1->setOdataType('microsoft.graph.windowsMalwareStateCount');
$malwareStateSummaryWindowsMalwareStateCount1->setState(new WindowsMalwareThreatState('actionFailed'));
$malwareStateSummaryWindowsMalwareStateCount1->setDeviceCount(11);
$malwareStateSummaryWindowsMalwareStateCount1->setMalwareDetectionCount(5);
$malwareStateSummaryWindowsMalwareStateCount1->setDistinctMalwareCount(4);
$malwareStateSummaryWindowsMalwareStateCount1->setLastUpdateDateTime(new \DateTime('2016-12-31T23:58:21.6459442-08:00'));
$malwareStateSummaryArray []= $malwareStateSummaryWindowsMalwareStateCount1;
$windowsMalwareOverview->setMalwareStateSummary($malwareStateSummaryArray);
$malwareSeveritySummaryWindowsMalwareSeverityCount1 = new WindowsMalwareSeverityCount();
$malwareSeveritySummaryWindowsMalwareSeverityCount1->setOdataType('microsoft.graph.windowsMalwareSeverityCount');
$malwareSeveritySummaryWindowsMalwareSeverityCount1->setSeverity(new WindowsMalwareSeverity('low'));
$malwareSeveritySummaryWindowsMalwareSeverityCount1->setMalwareDetectionCount(5);
$malwareSeveritySummaryWindowsMalwareSeverityCount1->setDistinctMalwareCount(4);
$malwareSeveritySummaryWindowsMalwareSeverityCount1->setLastUpdateDateTime(new \DateTime('2016-12-31T23:58:21.6459442-08:00'));
$malwareSeveritySummaryArray []= $malwareSeveritySummaryWindowsMalwareSeverityCount1;
$windowsMalwareOverview->setMalwareSeveritySummary($malwareSeveritySummaryArray);
$malwareExecutionStateSummaryWindowsMalwareExecutionStateCount1 = new WindowsMalwareExecutionStateCount();
$malwareExecutionStateSummaryWindowsMalwareExecutionStateCount1->setOdataType('microsoft.graph.windowsMalwareExecutionStateCount');
$malwareExecutionStateSummaryWindowsMalwareExecutionStateCount1->setExecutionState(new WindowsMalwareExecutionState('blocked'));
$malwareExecutionStateSummaryWindowsMalwareExecutionStateCount1->setDeviceCount(11);
$malwareExecutionStateSummaryWindowsMalwareExecutionStateCount1->setLastUpdateDateTime(new \DateTime('2016-12-31T23:58:21.6459442-08:00'));
$malwareExecutionStateSummaryArray []= $malwareExecutionStateSummaryWindowsMalwareExecutionStateCount1;
$windowsMalwareOverview->setMalwareExecutionStateSummary($malwareExecutionStateSummaryArray);
$malwareCategorySummaryWindowsMalwareCategoryCount1 = new WindowsMalwareCategoryCount();
$malwareCategorySummaryWindowsMalwareCategoryCount1->setOdataType('microsoft.graph.windowsMalwareCategoryCount');
$malwareCategorySummaryWindowsMalwareCategoryCount1->setCategory(new WindowsMalwareCategory('adware'));
$malwareCategorySummaryWindowsMalwareCategoryCount1->setDeviceCount(11);
$malwareCategorySummaryWindowsMalwareCategoryCount1->setActiveMalwareDetectionCount(11);
$malwareCategorySummaryWindowsMalwareCategoryCount1->setDistinctActiveMalwareCount(10);
$malwareCategorySummaryWindowsMalwareCategoryCount1->setLastUpdateDateTime(new \DateTime('2016-12-31T23:58:21.6459442-08:00'));
$malwareCategorySummaryArray []= $malwareCategorySummaryWindowsMalwareCategoryCount1;
$windowsMalwareOverview->setMalwareCategorySummary($malwareCategorySummaryArray);
$malwareNameSummaryWindowsMalwareNameCount1 = new WindowsMalwareNameCount();
$malwareNameSummaryWindowsMalwareNameCount1->setOdataType('microsoft.graph.windowsMalwareNameCount');
$malwareNameSummaryWindowsMalwareNameCount1->setMalwareIdentifier('Malware Identifier value');
$malwareNameSummaryWindowsMalwareNameCount1->setName('Name value');
$malwareNameSummaryWindowsMalwareNameCount1->setDeviceCount(11);
$malwareNameSummaryWindowsMalwareNameCount1->setLastUpdateDateTime(new \DateTime('2016-12-31T23:58:21.6459442-08:00'));
$malwareNameSummaryArray []= $malwareNameSummaryWindowsMalwareNameCount1;
$windowsMalwareOverview->setMalwareNameSummary($malwareNameSummaryArray);
$osVersionsSummaryOsVersionCount1 = new OsVersionCount();
$osVersionsSummaryOsVersionCount1->setOdataType('microsoft.graph.osVersionCount');
$osVersionsSummaryOsVersionCount1->setOsVersion('Os Version value');
$osVersionsSummaryOsVersionCount1->setDeviceCount(11);
$osVersionsSummaryOsVersionCount1->setLastUpdateDateTime(new \DateTime('2016-12-31T23:58:21.6459442-08:00'));
$osVersionsSummaryArray []= $osVersionsSummaryOsVersionCount1;
$windowsMalwareOverview->setOsVersionsSummary($osVersionsSummaryArray);
$requestBody->setWindowsMalwareOverview($windowsMalwareOverview);
$result = $graphServiceClient->deviceManagement()->patch($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.DeviceManagement
$params = @{
"@odata.type" = "#microsoft.graph.deviceManagement"
subscriptionState = "active"
deviceProtectionOverview = @{
"@odata.type" = "microsoft.graph.deviceProtectionOverview"
totalReportedDeviceCount = 8
inactiveThreatAgentDeviceCount = 14
unknownStateThreatAgentDeviceCount = 2
pendingSignatureUpdateDeviceCount = 1
cleanDeviceCount = 0
pendingFullScanDeviceCount = 10
pendingRestartDeviceCount = 9
pendingManualStepsDeviceCount = 13
pendingOfflineScanDeviceCount = 13
criticalFailuresDeviceCount = 11
pendingQuickScanDeviceCount = 11
}
windowsMalwareOverview = @{
"@odata.type" = "microsoft.graph.windowsMalwareOverview"
malwareDetectedDeviceCount = 10
totalMalwareCount = 1
totalDistinctMalwareCount = 9
malwareStateSummary = @(
@{
"@odata.type" = "microsoft.graph.windowsMalwareStateCount"
state = "actionFailed"
deviceCount = 11
malwareDetectionCount = 5
distinctMalwareCount = 4
lastUpdateDateTime = [System.DateTime]::Parse("2016-12-31T23:58:21.6459442-08:00")
}
)
malwareSeveritySummary = @(
@{
"@odata.type" = "microsoft.graph.windowsMalwareSeverityCount"
severity = "low"
malwareDetectionCount = 5
distinctMalwareCount = 4
lastUpdateDateTime = [System.DateTime]::Parse("2016-12-31T23:58:21.6459442-08:00")
}
)
malwareExecutionStateSummary = @(
@{
"@odata.type" = "microsoft.graph.windowsMalwareExecutionStateCount"
executionState = "blocked"
deviceCount = 11
lastUpdateDateTime = [System.DateTime]::Parse("2016-12-31T23:58:21.6459442-08:00")
}
)
malwareCategorySummary = @(
@{
"@odata.type" = "microsoft.graph.windowsMalwareCategoryCount"
category = "adware"
deviceCount = 11
activeMalwareDetectionCount = 11
distinctActiveMalwareCount = 10
lastUpdateDateTime = [System.DateTime]::Parse("2016-12-31T23:58:21.6459442-08:00")
}
)
malwareNameSummary = @(
@{
"@odata.type" = "microsoft.graph.windowsMalwareNameCount"
malwareIdentifier = "Malware Identifier value"
name = "Name value"
deviceCount = 11
lastUpdateDateTime = [System.DateTime]::Parse("2016-12-31T23:58:21.6459442-08:00")
}
)
osVersionsSummary = @(
@{
"@odata.type" = "microsoft.graph.osVersionCount"
osVersion = "Os Version value"
deviceCount = 11
lastUpdateDateTime = [System.DateTime]::Parse("2016-12-31T23:58:21.6459442-08:00")
}
)
}
}
Update-MgDeviceManagement -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.device_management import DeviceManagement
from msgraph.generated.models.device_management_subscription_state import DeviceManagementSubscriptionState
from msgraph.generated.models.device_protection_overview import DeviceProtectionOverview
from msgraph.generated.models.windows_malware_overview import WindowsMalwareOverview
from msgraph.generated.models.windows_malware_state_count import WindowsMalwareStateCount
from msgraph.generated.models.windows_malware_threat_state import WindowsMalwareThreatState
from msgraph.generated.models.windows_malware_severity_count import WindowsMalwareSeverityCount
from msgraph.generated.models.windows_malware_severity import WindowsMalwareSeverity
from msgraph.generated.models.windows_malware_execution_state_count import WindowsMalwareExecutionStateCount
from msgraph.generated.models.windows_malware_execution_state import WindowsMalwareExecutionState
from msgraph.generated.models.windows_malware_category_count import WindowsMalwareCategoryCount
from msgraph.generated.models.windows_malware_category import WindowsMalwareCategory
from msgraph.generated.models.windows_malware_name_count import WindowsMalwareNameCount
from msgraph.generated.models.os_version_count import OsVersionCount
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = DeviceManagement(
odata_type = "#microsoft.graph.deviceManagement",
subscription_state = DeviceManagementSubscriptionState.Active,
device_protection_overview = DeviceProtectionOverview(
odata_type = "microsoft.graph.deviceProtectionOverview",
total_reported_device_count = 8,
inactive_threat_agent_device_count = 14,
unknown_state_threat_agent_device_count = 2,
pending_signature_update_device_count = 1,
clean_device_count = 0,
pending_full_scan_device_count = 10,
pending_restart_device_count = 9,
pending_manual_steps_device_count = 13,
pending_offline_scan_device_count = 13,
critical_failures_device_count = 11,
pending_quick_scan_device_count = 11,
),
windows_malware_overview = WindowsMalwareOverview(
odata_type = "microsoft.graph.windowsMalwareOverview",
malware_detected_device_count = 10,
total_malware_count = 1,
total_distinct_malware_count = 9,
malware_state_summary = [
WindowsMalwareStateCount(
odata_type = "microsoft.graph.windowsMalwareStateCount",
state = WindowsMalwareThreatState.ActionFailed,
device_count = 11,
malware_detection_count = 5,
distinct_malware_count = 4,
last_update_date_time = "2016-12-31T23:58:21.6459442-08:00",
),
],
malware_severity_summary = [
WindowsMalwareSeverityCount(
odata_type = "microsoft.graph.windowsMalwareSeverityCount",
severity = WindowsMalwareSeverity.Low,
malware_detection_count = 5,
distinct_malware_count = 4,
last_update_date_time = "2016-12-31T23:58:21.6459442-08:00",
),
],
malware_execution_state_summary = [
WindowsMalwareExecutionStateCount(
odata_type = "microsoft.graph.windowsMalwareExecutionStateCount",
execution_state = WindowsMalwareExecutionState.Blocked,
device_count = 11,
last_update_date_time = "2016-12-31T23:58:21.6459442-08:00",
),
],
malware_category_summary = [
WindowsMalwareCategoryCount(
odata_type = "microsoft.graph.windowsMalwareCategoryCount",
category = WindowsMalwareCategory.Adware,
device_count = 11,
active_malware_detection_count = 11,
distinct_active_malware_count = 10,
last_update_date_time = "2016-12-31T23:58:21.6459442-08:00",
),
],
malware_name_summary = [
WindowsMalwareNameCount(
odata_type = "microsoft.graph.windowsMalwareNameCount",
malware_identifier = "Malware Identifier value",
name = "Name value",
device_count = 11,
last_update_date_time = "2016-12-31T23:58:21.6459442-08:00",
),
],
os_versions_summary = [
OsVersionCount(
odata_type = "microsoft.graph.osVersionCount",
os_version = "Os Version value",
device_count = 11,
last_update_date_time = "2016-12-31T23:58:21.6459442-08:00",
),
],
),
)
result = await graph_client.device_management.patch(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.