Namespace: microsoft.graph
Get a protection rule that's associated with a protection policy. You can use this operation to get mailbox, drive, and site protection rules.
An inclusion rule indicates that a protection policy should contain protection units that match the specified rule criteria. The initial status of a protection rule upon creation is active
. After the rule is applied, the state is either completed
or completedWithErrors
.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
❌ |
❌ |
❌ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type |
Least privileged permissions |
Higher privileged permissions |
Delegated (work or school account) |
BackupRestore-Configuration.Read.All |
BackupRestore-Configuration.ReadWrite.All |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
BackupRestore-Configuration.Read.All |
BackupRestore-Configuration.ReadWrite.All |
HTTP request
GET /solutions/backupRestore/sharePointProtectionPolicies/{sharePointProtectionPolicyId}/siteInclusionRules/{siteProtectionRuleId}
GET /solutions/backupRestore/oneDriveForBusinessProtectionPolicies/{oneDriveForBusinessProtectionPolicyId}/driveInclusionRules/{driveProtectionRuleId}
GET /solutions/backupRestore/exchangeProtectionPolicies/{exchangeProtectionPolicyId}/mailboxInclusionRules/{mailboxProtectionRuleId}
Request body
Don't supply a request body for this method.
Response
If successful, this method returns a 200 OK
response code and a protectionRuleBase object in the response body.
Examples
Example 1: Get siteInclusionRule associated with a SharePoint protection policy
The following example shows how to get a siteInclusionRule associated with a sharePointProtectionPolicy.
Request
The following example shows a request.
GET https://graph.microsoft.com/v1.0/solutions/backupRestore/sharePointProtectionPolicies/71633878-8321-4950-bfaf-ed285bdd1461/siteInclusionRules/61633878-8321-4950-bfaf-ed285bdd1461
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Solutions.BackupRestore.SharePointProtectionPolicies["{sharePointProtectionPolicy-id}"].SiteInclusionRules["{siteProtectionRule-id}"].GetAsync();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc solutions backup-restore share-point-protection-policies site-inclusion-rules get --share-point-protection-policy-id {sharePointProtectionPolicy-id} --site-protection-rule-id {siteProtectionRule-id}
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"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
siteInclusionRules, err := graphClient.Solutions().BackupRestore().SharePointProtectionPolicies().BySharePointProtectionPolicyId("sharePointProtectionPolicy-id").SiteInclusionRules().BySiteProtectionRuleId("siteProtectionRule-id").Get(context.Background(), 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);
SiteProtectionRule result = graphClient.solutions().backupRestore().sharePointProtectionPolicies().bySharePointProtectionPolicyId("{sharePointProtectionPolicy-id}").siteInclusionRules().bySiteProtectionRuleId("{siteProtectionRule-id}").get();
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);
let siteProtectionRule = await client.api('/solutions/backupRestore/sharePointProtectionPolicies/71633878-8321-4950-bfaf-ed285bdd1461/siteInclusionRules/61633878-8321-4950-bfaf-ed285bdd1461')
.get();
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;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->solutions()->backupRestore()->sharePointProtectionPolicies()->bySharePointProtectionPolicyId('sharePointProtectionPolicy-id')->siteInclusionRules()->bySiteProtectionRuleId('siteProtectionRule-id')->get()->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.BackupRestore
Get-MgSolutionBackupRestoreSharePointProtectionPolicySiteInclusionRule -SharePointProtectionPolicyId $sharePointProtectionPolicyId -SiteProtectionRuleId $siteProtectionRuleId
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
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.solutions.backup_restore.share_point_protection_policies.by_share_point_protection_policy_id('sharePointProtectionPolicy-id').site_inclusion_rules.by_site_protection_rule_id('siteProtectionRule-id').get()
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response.
HTTP/1.1 200 OK
Content-Location: https://graph.microsoft.com/v1.0/solutions/backupRestore/sharePointProtectionPolicies/71633878-8321-4950-bfaf-ed285bdd1461/siteInclusionRules('61633878-8321-4950-bfaf-ed285bdd1461')
{
"@odata.type": "#microsoft.graph.siteProtectionRule",
"id":"61633878-8321-4950-bfaf-ed285bdd1461",
"status" : "completed",
"createdBy":{
"application":{
"id":"1fec8e78-bce4-4aaf-ab1b-5451cc387264"
},
"user":{
"id":"845457dc-4bb2-4815-bef3-8628ebd1952e"
}
},
"createdDateTime":"2015-06-19T12:01:03.45Z",
"lastModifiedBy":{
"application":{
"id":"1fec8e78-bce4-4aaf-ab1b-5451cc387264"
},
"user":{
"id":"845457dc-4bb2-4815-bef3-8628ebd1952e"
}
},
"lastModifiedDateTime":"2015-06-19T12:01:03.45Z",
"isAutoApplyEnabled": false,
"siteExpression": "((displayName -contains 'Finance') -or (displayName -contains 'Legal'))"
}
Example 2: Get a driveInclusionRule associated with an OneDriveForBusiness protection policy
he following example shows how to get a driveInclusionRule associated with an oneDriveForBusinessProtectionPolicy.
Request
The following example shows a request.
GET https://graph.microsoft.com/v1.0/solutions/backupRestore/oneDriveForBusinessProtectionPolicies/71633878-8321-4950-bfaf-ed285bdd1461/driveInclusionRules/61633878-8321-4950-bfaf-ed285bdd1461
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Solutions.BackupRestore.OneDriveForBusinessProtectionPolicies["{oneDriveForBusinessProtectionPolicy-id}"].DriveInclusionRules["{driveProtectionRule-id}"].GetAsync();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc solutions backup-restore one-drive-for-business-protection-policies drive-inclusion-rules get --one-drive-for-business-protection-policy-id {oneDriveForBusinessProtectionPolicy-id} --drive-protection-rule-id {driveProtectionRule-id}
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"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
driveInclusionRules, err := graphClient.Solutions().BackupRestore().OneDriveForBusinessProtectionPolicies().ByOneDriveForBusinessProtectionPolicyId("oneDriveForBusinessProtectionPolicy-id").DriveInclusionRules().ByDriveProtectionRuleId("driveProtectionRule-id").Get(context.Background(), 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);
DriveProtectionRule result = graphClient.solutions().backupRestore().oneDriveForBusinessProtectionPolicies().byOneDriveForBusinessProtectionPolicyId("{oneDriveForBusinessProtectionPolicy-id}").driveInclusionRules().byDriveProtectionRuleId("{driveProtectionRule-id}").get();
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);
let driveProtectionRule = await client.api('/solutions/backupRestore/oneDriveForBusinessProtectionPolicies/71633878-8321-4950-bfaf-ed285bdd1461/driveInclusionRules/61633878-8321-4950-bfaf-ed285bdd1461')
.get();
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;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->solutions()->backupRestore()->oneDriveForBusinessProtectionPolicies()->byOneDriveForBusinessProtectionPolicyId('oneDriveForBusinessProtectionPolicy-id')->driveInclusionRules()->byDriveProtectionRuleId('driveProtectionRule-id')->get()->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.BackupRestore
Get-MgSolutionBackupRestoreOneDriveForBusinessProtectionPolicyDriveInclusionRule -OneDriveForBusinessProtectionPolicyId $oneDriveForBusinessProtectionPolicyId -DriveProtectionRuleId $driveProtectionRuleId
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
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.solutions.backup_restore.one_drive_for_business_protection_policies.by_one_drive_for_business_protection_policy_id('oneDriveForBusinessProtectionPolicy-id').drive_inclusion_rules.by_drive_protection_rule_id('driveProtectionRule-id').get()
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response.
HTTP/1.1 200 OK
Content-Location: https://graph.microsoft.com/v1.0/solutions/backupRestore/oneDriveForBusinessProtectionPolicies/71633878-8321-4950-bfaf-ed285bdd1461/driveInclusionRules('61633878-8321-4950-bfaf-ed285bdd1461')
{
"@odata.type": "#microsoft.graph.driveProtectionRule",
"id":"61633878-8321-4950-bfaf-ed285bdd1461",
"status" : "active",
"createdBy":{
"application":{
"id":"1fec8e78-bce4-4aaf-ab1b-5451cc387264"
},
"user":{
"id":"845457dc-4bb2-4815-bef3-8628ebd1952e"
}
},
"createdDateTime":"2015-06-19T12:01:03.45Z",
"lastModifiedBy":{
"application":{
"id":"1fec8e78-bce4-4aaf-ab1b-5451cc387264"
},
"user":{
"id":"845457dc-4bb2-4815-bef3-8628ebd1952e"
}
},
"lastModifiedDateTime":"2015-06-19T12:01:03.45Z",
"isAutoApplyEnabled": false,
"driveExpression": "(memberOf -any (group.id -in ['b418eb4a-ea72-42bd-8f0b-d0bbf794bec7']))"
}
Example 3: Get a mailboxInclusionRule associated with an Exchange protection policy
he following example shows how to get a mailboxInclusionRule associated with an exchangeProtectionPolicy.
Request
The following example shows a request.
GET https://graph.microsoft.com/v1.0/solutions/backupRestore/exchangeProtectionPolicies/71633878-8321-4950-bfaf-ed285bdd1461/mailboxInclusionRules/61633878-8321-4950-bfaf-ed285bdd1461
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Solutions.BackupRestore.ExchangeProtectionPolicies["{exchangeProtectionPolicy-id}"].MailboxInclusionRules["{mailboxProtectionRule-id}"].GetAsync();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc solutions backup-restore exchange-protection-policies mailbox-inclusion-rules get --exchange-protection-policy-id {exchangeProtectionPolicy-id} --mailbox-protection-rule-id {mailboxProtectionRule-id}
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"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
mailboxInclusionRules, err := graphClient.Solutions().BackupRestore().ExchangeProtectionPolicies().ByExchangeProtectionPolicyId("exchangeProtectionPolicy-id").MailboxInclusionRules().ByMailboxProtectionRuleId("mailboxProtectionRule-id").Get(context.Background(), 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);
MailboxProtectionRule result = graphClient.solutions().backupRestore().exchangeProtectionPolicies().byExchangeProtectionPolicyId("{exchangeProtectionPolicy-id}").mailboxInclusionRules().byMailboxProtectionRuleId("{mailboxProtectionRule-id}").get();
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);
let mailboxProtectionRule = await client.api('/solutions/backupRestore/exchangeProtectionPolicies/71633878-8321-4950-bfaf-ed285bdd1461/mailboxInclusionRules/61633878-8321-4950-bfaf-ed285bdd1461')
.get();
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;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->solutions()->backupRestore()->exchangeProtectionPolicies()->byExchangeProtectionPolicyId('exchangeProtectionPolicy-id')->mailboxInclusionRules()->byMailboxProtectionRuleId('mailboxProtectionRule-id')->get()->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.BackupRestore
Get-MgSolutionBackupRestoreExchangeProtectionPolicyMailboxInclusionRule -ExchangeProtectionPolicyId $exchangeProtectionPolicyId -MailboxProtectionRuleId $mailboxProtectionRuleId
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
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.solutions.backup_restore.exchange_protection_policies.by_exchange_protection_policy_id('exchangeProtectionPolicy-id').mailbox_inclusion_rules.by_mailbox_protection_rule_id('mailboxProtectionRule-id').get()
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response.
Http/1.1 200 OK
Content-Location: https://graph.microsoft.com/v1.0/solutions/backupRestore/exchangeProtectionPolicies/71633878-8321-4950-bfaf-ed285bdd1461/mailboxInclusionRules('61633878-8321-4950-bfaf-ed285bdd1461')
{
"@odata.type": "#microsoft.graph.mailboxProtectionRule",
"id":"61633878-8321-4950-bfaf-ed285bdd1461",
"status" : "active",
"createdBy":{
"application":{
"id":"1fec8e78-bce4-4aaf-ab1b-5451cc387264"
},
"user":{
"id":"845457dc-4bb2-4815-bef3-8628ebd1952e"
}
},
"createdDateTime":"2015-06-19T12:01:03.45Z",
"lastModifiedBy":{
"application":{
"id":"1fec8e78-bce4-4aaf-ab1b-5451cc387264"
},
"user":{
"id":"845457dc-4bb2-4815-bef3-8628ebd1952e"
}
},
"lastModifiedDateTime":"2015-06-19T12:01:03.45Z",
"isAutoApplyEnabled": false,
"mailboxExpression": "(memberOf -any (group.id -in ['b418eb4a-ea72-42bd-8f0b-d0bbf794bec7']))"
}