Skip to content

Latest commit

 

History

History
36 lines (29 loc) · 1.05 KB

File metadata and controls

36 lines (29 loc) · 1.05 KB
description Automatically generated file. DO NOT MODIFY
// Code snippets are only available for the latest version. Current version is 5.x

// Dependencies
using Microsoft.Graph.Models;

var requestBody = new SharePointProtectionPolicy
{
	DisplayName = "SharePoint Protection Policy",
	SiteProtectionUnits = new List<SiteProtectionUnit>
	{
		new SiteProtectionUnit
		{
			SiteId = "contoso.sharepoint.com,febad3c2-a7b2-454c-8910-272c7bcf78fc,ba7b70d0-8ba0-4cae-b19a-7cb8c739512f",
		},
		new SiteProtectionUnit
		{
			SiteId = "contoso.sharepoint.com/sites/marketing,da60e844-ba1d-49bc-b4d4-d5e36bae9019,712a596e-90a1-49e3-9b48-bfa80bee8740",
		},
		new SiteProtectionUnit
		{
			SiteId = "contoso.sharepoint.com/sites/hr,3bfc861e-9a17-4a27-9562-3d8b26c81bb5,0271110f-634f-4300-a841-3a8a2e851851",
		},
	},
};

// 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.PostAsync(requestBody);