Article
11/30/2023
11 contributors
Feedback
In this article
Namespace: microsoft.graph
Note: The Microsoft Graph API for Intune requires an active Intune license for the tenant.
Update the properties of a windowsInformationProtectionAppLockerFile object.
This API is available in the following national cloud deployments .
Global service
US Government L4
US Government L5 (DOD)
China operated by 21Vianet
✅
✅
✅
✅
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions .
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
DeviceManagementApps.ReadWrite.All
Delegated (personal Microsoft account)
Not supported.
Application
DeviceManagementApps.ReadWrite.All
HTTP Request
PATCH /deviceAppManagement/windowsInformationProtectionPolicies/{windowsInformationProtectionPolicyId}/exemptAppLockerFiles/{windowsInformationProtectionAppLockerFileId}
PATCH /deviceAppManagement/windowsInformationProtectionPolicies/{windowsInformationProtectionPolicyId}/protectedAppLockerFiles/{windowsInformationProtectionAppLockerFileId}
PATCH /deviceAppManagement/mdmWindowsInformationProtectionPolicies/{mdmWindowsInformationProtectionPolicyId}/exemptAppLockerFiles/{windowsInformationProtectionAppLockerFileId}
PATCH /deviceAppManagement/mdmWindowsInformationProtectionPolicies/{mdmWindowsInformationProtectionPolicyId}/protectedAppLockerFiles/{windowsInformationProtectionAppLockerFileId}
Request body
In the request body, supply a JSON representation for the windowsInformationProtectionAppLockerFile object.
The following table shows the properties that are required when you create the windowsInformationProtectionAppLockerFile .
Property
Type
Description
displayName
String
The friendly name
fileHash
String
SHA256 hash of the file
file
Binary
File as a byte array
id
String
Key of the entity.
version
String
Version of the entity.
Response
If successful, this method returns a 200 OK
response code and an updated windowsInformationProtectionAppLockerFile object in the response body.
Example
Request
Here is an example of the request.
PATCH https://graph.microsoft.com/v1.0/deviceAppManagement/windowsInformationProtectionPolicies/{windowsInformationProtectionPolicyId}/exemptAppLockerFiles/{windowsInformationProtectionAppLockerFileId}
Content-type: application/json
Content-length: 211
{
"@odata.type": "#microsoft.graph.windowsInformationProtectionAppLockerFile",
"displayName": "Display Name value",
"fileHash": "File Hash value",
"file": "ZmlsZQ==",
"version": "Version value"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new WindowsInformationProtectionAppLockerFile
{
OdataType = "#microsoft.graph.windowsInformationProtectionAppLockerFile",
DisplayName = "Display Name value",
FileHash = "File Hash value",
File = Convert.FromBase64String("ZmlsZQ=="),
Version = "Version value",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceAppManagement.WindowsInformationProtectionPolicies["{windowsInformationProtectionPolicy-id}"].ExemptAppLockerFiles["{windowsInformationProtectionAppLockerFile-id}"].PatchAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc device-app-management windows-information-protection-policies exempt-app-locker-files patch --windows-information-protection-policy-id {windowsInformationProtectionPolicy-id} --windows-information-protection-app-locker-file-id {windowsInformationProtectionAppLockerFile-id} --body '{\
"@odata.type": "#microsoft.graph.windowsInformationProtectionAppLockerFile",\
"displayName": "Display Name value",\
"fileHash": "File Hash value",\
"file": "ZmlsZQ==",\
"version": "Version value"\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewWindowsInformationProtectionAppLockerFile()
displayName := "Display Name value"
requestBody.SetDisplayName(&displayName)
fileHash := "File Hash value"
requestBody.SetFileHash(&fileHash)
file := []byte("zmlsZQ==")
requestBody.SetFile(&file)
version := "Version value"
requestBody.SetVersion(&version)
exemptAppLockerFiles, err := graphClient.DeviceAppManagement().WindowsInformationProtectionPolicies().ByWindowsInformationProtectionPolicyId("windowsInformationProtectionPolicy-id").ExemptAppLockerFiles().ByWindowsInformationProtectionAppLockerFileId("windowsInformationProtectionAppLockerFile-id").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);
WindowsInformationProtectionAppLockerFile windowsInformationProtectionAppLockerFile = new WindowsInformationProtectionAppLockerFile();
windowsInformationProtectionAppLockerFile.setOdataType("#microsoft.graph.windowsInformationProtectionAppLockerFile");
windowsInformationProtectionAppLockerFile.setDisplayName("Display Name value");
windowsInformationProtectionAppLockerFile.setFileHash("File Hash value");
byte[] file = Base64.getDecoder().decode("ZmlsZQ==");
windowsInformationProtectionAppLockerFile.setFile(file);
windowsInformationProtectionAppLockerFile.setVersion("Version value");
WindowsInformationProtectionAppLockerFile result = graphClient.deviceAppManagement().windowsInformationProtectionPolicies().byWindowsInformationProtectionPolicyId("{windowsInformationProtectionPolicy-id}").exemptAppLockerFiles().byWindowsInformationProtectionAppLockerFileId("{windowsInformationProtectionAppLockerFile-id}").patch(windowsInformationProtectionAppLockerFile);
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 windowsInformationProtectionAppLockerFile = {
'@odata.type': '#microsoft.graph.windowsInformationProtectionAppLockerFile',
displayName: 'Display Name value',
fileHash: 'File Hash value',
file: 'ZmlsZQ==',
version: 'Version value'
};
await client.api('/deviceAppManagement/windowsInformationProtectionPolicies/{windowsInformationProtectionPolicyId}/exemptAppLockerFiles/{windowsInformationProtectionAppLockerFileId}')
.update(windowsInformationProtectionAppLockerFile);
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\WindowsInformationProtectionAppLockerFile;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new WindowsInformationProtectionAppLockerFile();
$requestBody->setOdataType('#microsoft.graph.windowsInformationProtectionAppLockerFile');
$requestBody->setDisplayName('Display Name value');
$requestBody->setFileHash('File Hash value');
$requestBody->setFile(\GuzzleHttp\Psr7\Utils::streamFor(base64_decode('ZmlsZQ==')));
$requestBody->setVersion('Version value');
$result = $graphServiceClient->deviceAppManagement()->windowsInformationProtectionPolicies()->byWindowsInformationProtectionPolicyId('windowsInformationProtectionPolicy-id')->exemptAppLockerFiles()->byWindowsInformationProtectionAppLockerFileId('windowsInformationProtectionAppLockerFile-id')->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.Devices.CorporateManagement
$params = @{
"@odata.type" = "#microsoft.graph.windowsInformationProtectionAppLockerFile"
displayName = "Display Name value"
fileHash = "File Hash value"
file = [System.Text.Encoding]::ASCII.GetBytes("ZmlsZQ==")
version = "Version value"
}
Update-MgDeviceAppManagementWindowsInformationProtectionPolicyExemptAppLockerFile -WindowsInformationProtectionPolicyId $windowsInformationProtectionPolicyId -WindowsInformationProtectionAppLockerFileId $windowsInformationProtectionAppLockerFileId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
from msgraph import GraphServiceClient
from msgraph.generated.models.windows_information_protection_app_locker_file import WindowsInformationProtectionAppLockerFile
graph_client = GraphServiceClient(credentials, scopes)
request_body = WindowsInformationProtectionAppLockerFile(
odata_type = "#microsoft.graph.windowsInformationProtectionAppLockerFile",
display_name = "Display Name value",
file_hash = "File Hash value",
file = base64.urlsafe_b64decode("ZmlsZQ=="),
version = "Version value",
)
result = await graph_client.device_app_management.windows_information_protection_policies.by_windows_information_protection_policy_id('windowsInformationProtectionPolicy-id').exempt_app_locker_files.by_windows_information_protection_app_locker_file_id('windowsInformationProtectionAppLockerFile-id').patch(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
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.
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 260
{
"@odata.type": "#microsoft.graph.windowsInformationProtectionAppLockerFile",
"displayName": "Display Name value",
"fileHash": "File Hash value",
"file": "ZmlsZQ==",
"id": "d81f0e40-0e40-d81f-400e-1fd8400e1fd8",
"version": "Version value"
}