Modify permissions to a Directory or Files with Net
With the code below you can copy and set specific permissions to a directory within Net app.
using System.Security.AccessControl;
using System.Security.Principal;
string sourceFolder = ConfigurationManager.AppSettings["sourceFolder"];
string newFolder = ConfigurationManager.AppSettings["newFolder"];
Console.WriteLine($"sourceFolder {sourceFolder}");
string lastFolder = sourceFolder.Split('\\').Last();
newFolder = Path.Combine(newFolder, lastFolder);
Directory.Move(sourceFolder, newFolder);
// Get security settings from the subfolder
DirectoryInfo newDirInfo = new DirectoryInfo(newFolder);
DirectorySecurity newFolderSecurity = newDirInfo.GetAccessControl();
// Enable inheritance on the subfolder
newFolderSecurity.SetAccessRuleProtection(false, false); // False = enable inheritance, True = preserve inherited rules
// Apply the parent's security rules to the subfolder
newDirInfo.SetAccessControl(newFolderSecurity);
Console.WriteLine($"Folder {newFolder} security is updated");
Net 10.0 is not available for Azure Functions. How to fix
Custom Label with multiple styles in TextField of Fluent UI
First impressions after using the new SPFX 1.22.2 with Heft