/
FileSystemSecurity.xml
845 lines (762 loc) · 67.6 KB
/
FileSystemSecurity.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
<Type Name="FileSystemSecurity" FullName="System.Security.AccessControl.FileSystemSecurity">
<TypeSignature Language="C#" Value="public abstract class FileSystemSecurity : System.Security.AccessControl.NativeObjectSecurity" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract beforefieldinit FileSystemSecurity extends System.Security.AccessControl.NativeObjectSecurity" />
<TypeSignature Language="DocId" Value="T:System.Security.AccessControl.FileSystemSecurity" />
<TypeSignature Language="VB.NET" Value="Public MustInherit Class FileSystemSecurity
Inherits NativeObjectSecurity" />
<TypeSignature Language="C++ CLI" Value="public ref class FileSystemSecurity abstract : System::Security::AccessControl::NativeObjectSecurity" />
<TypeSignature Language="F#" Value="type FileSystemSecurity = class
 inherit NativeObjectSecurity" />
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Security.AccessControl.NativeObjectSecurity</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1">
<AttributeName>System.Security.SecurityCritical</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Represents the access control and audit security for a file or directory.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Security.AccessControl.FileSystemSecurity> class is the base class for the <xref:System.Security.AccessControl.FileSecurity> and <xref:System.Security.AccessControl.DirectorySecurity> classes. These classes represent all of the access rights for a system file or directory and define how access attempts are audited.
The <xref:System.Security.AccessControl.FileSystemSecurity> class represents access and audit rights as a set of rules. Each access rule is represented by a <xref:System.Security.AccessControl.FileSystemAccessRule> object, while each audit rule is represented by a <xref:System.Security.AccessControl.FileSystemAuditRule> object.
The <xref:System.Security.AccessControl.FileSystemSecurity> class is an abstraction of the underlying Microsoft Windows file security system. In this system, each file or directory has a discretionary access control list (DACL), which controls access to the file or directory, and a system access control list (SACL), which specifies the access control attempts that are audited. The <xref:System.Security.AccessControl.FileSystemAccessRule> and <xref:System.Security.AccessControl.FileSystemAuditRule> classes are abstractions of access control entries (ACEs) that comprise DACLs and SACLs.
The <xref:System.Security.AccessControl.FileSystemSecurity> class hides many of details of DACLs and SACLs; you do not have to worry about ACE ordering or null DACLS.
To persist new or changed access control list (ACL) information to a file, use the <xref:System.IO.File.SetAccessControl%2A> or <xref:System.IO.FileInfo.SetAccessControl%2A> method. To persist new or changed ACL information to a directory, use the <xref:System.IO.Directory.SetAccessControl%2A> or <xref:System.IO.FileInfo.SetAccessControl%2A> method.
To retrieve ACL information from a file, use the <xref:System.IO.File.GetAccessControl%2A> or <xref:System.IO.FileInfo.GetAccessControl%2A> method. To retrieve ACL information from a directory, use the <xref:System.IO.Directory.GetAccessControl%2A> or <xref:System.IO.DirectoryInfo.GetAccessControl%2A> method.
## Examples
The following code example uses the <xref:System.Security.AccessControl.FileSecurity> class to add and then remove an access control list (ACL) entry from a file. You must supply a valid user or group account to run this example.
[!code-cpp[IO.File.GetAccessControl-SetAccessControl#1](~/samples/snippets/cpp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/cpp/sample.cpp#1)]
[!code-csharp[IO.File.GetAccessControl-SetAccessControl#1](~/samples/snippets/csharp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/CS/sample.cs#1)]
[!code-vb[IO.File.GetAccessControl-SetAccessControl#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/VB/sample.vb#1)]
]]></format>
</remarks>
</Docs>
<Members>
<Member MemberName="AccessRightType">
<MemberSignature Language="C#" Value="public override Type AccessRightType { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Type AccessRightType" />
<MemberSignature Language="DocId" Value="P:System.Security.AccessControl.FileSystemSecurity.AccessRightType" />
<MemberSignature Language="VB.NET" Value="Public Overrides ReadOnly Property AccessRightType As Type" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual property Type ^ AccessRightType { Type ^ get(); };" />
<MemberSignature Language="F#" Value="member this.AccessRightType : Type" Usage="System.Security.AccessControl.FileSystemSecurity.AccessRightType" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Type</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the enumeration that the <see cref="T:System.Security.AccessControl.FileSystemSecurity" /> class uses to represent access rights.</summary>
<value>A <see cref="T:System.Type" /> object representing the <see cref="T:System.Security.AccessControl.FileSystemRights" /> enumeration.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Classes that derive from the <xref:System.Security.AccessControl.FileSystemSecurity> class override the <xref:System.Security.AccessControl.FileSystemSecurity.AccessRightType%2A> property and return the type they use to represent access rights. When you work with arrays or collections that contain multiple types of security objects, use this property to determine the correct enumeration type to use with each security object.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="AccessRuleFactory">
<MemberSignature Language="C#" Value="public override sealed System.Security.AccessControl.AccessRule AccessRuleFactory (System.Security.Principal.IdentityReference identityReference, int accessMask, bool isInherited, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags, System.Security.AccessControl.AccessControlType type);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance class System.Security.AccessControl.AccessRule AccessRuleFactory(class System.Security.Principal.IdentityReference identityReference, int32 accessMask, bool isInherited, valuetype System.Security.AccessControl.InheritanceFlags inheritanceFlags, valuetype System.Security.AccessControl.PropagationFlags propagationFlags, valuetype System.Security.AccessControl.AccessControlType type) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Security.AccessControl.FileSystemSecurity.AccessRuleFactory(System.Security.Principal.IdentityReference,System.Int32,System.Boolean,System.Security.AccessControl.InheritanceFlags,System.Security.AccessControl.PropagationFlags,System.Security.AccessControl.AccessControlType)" />
<MemberSignature Language="C++ CLI" Value="public:
 override System::Security::AccessControl::AccessRule ^ AccessRuleFactory(System::Security::Principal::IdentityReference ^ identityReference, int accessMask, bool isInherited, System::Security::AccessControl::InheritanceFlags inheritanceFlags, System::Security::AccessControl::PropagationFlags propagationFlags, System::Security::AccessControl::AccessControlType type);" />
<MemberSignature Language="F#" Value="override this.AccessRuleFactory : System.Security.Principal.IdentityReference * int * bool * System.Security.AccessControl.InheritanceFlags * System.Security.AccessControl.PropagationFlags * System.Security.AccessControl.AccessControlType -> System.Security.AccessControl.AccessRule" Usage="fileSystemSecurity.AccessRuleFactory (identityReference, accessMask, isInherited, inheritanceFlags, propagationFlags, type)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Security.AccessControl.AccessRule</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="identityReference" Type="System.Security.Principal.IdentityReference" />
<Parameter Name="accessMask" Type="System.Int32" />
<Parameter Name="isInherited" Type="System.Boolean" />
<Parameter Name="inheritanceFlags" Type="System.Security.AccessControl.InheritanceFlags" />
<Parameter Name="propagationFlags" Type="System.Security.AccessControl.PropagationFlags" />
<Parameter Name="type" Type="System.Security.AccessControl.AccessControlType" />
</Parameters>
<Docs>
<param name="identityReference">An <see cref="T:System.Security.Principal.IdentityReference" /> object that represents a user account.</param>
<param name="accessMask">An integer that specifies an access type.</param>
<param name="isInherited">
<see langword="true" /> if the access rule is inherited; otherwise, <see langword="false" />.</param>
<param name="inheritanceFlags">One of the <see cref="T:System.Security.AccessControl.InheritanceFlags" /> values that specifies how to propagate access masks to child objects.</param>
<param name="propagationFlags">One of the <see cref="T:System.Security.AccessControl.PropagationFlags" /> values that specifies how to propagate Access Control Entries (ACEs) to child objects.</param>
<param name="type">One of the <see cref="T:System.Security.AccessControl.AccessControlType" /> values that specifies whether access is allowed or denied.</param>
<summary>Initializes a new instance of the <see cref="T:System.Security.AccessControl.FileSystemAccessRule" /> class that represents a new access control rule for the specified user, with the specified access rights, access control, and flags.</summary>
<returns>A new <see cref="T:System.Security.AccessControl.FileSystemAccessRule" /> object that represents a new access control rule for the specified user, with the specified access rights, access control, and flags.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The recommended way to create access control rules is to use the constructors of the <xref:System.Security.AccessControl.FileSystemAccessRule> class.
The return type of the <xref:System.Security.AccessControl.FileSystemSecurity.AccessRuleFactory%2A> method is the base class, <xref:System.Security.AccessControl.AccessRule>, but the return value can be cast safely to the derived class.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="accessMask" />, <paramref name="inheritanceFlags" />, <paramref name="propagationFlags" />, or <paramref name="type" /> parameters specify an invalid value.</exception>
<exception cref="T:System.ArgumentNullException">The <paramref name="identityReference" /> parameter is <see langword="null" />.
-or-
The <paramref name="accessMask" /> parameter is zero.</exception>
<exception cref="T:System.ArgumentException">The <paramref name="identityReference" /> parameter is neither of type <see cref="T:System.Security.Principal.SecurityIdentifier" />, nor of a type such as <see cref="T:System.Security.Principal.NTAccount" /> that can be converted to type <see cref="T:System.Security.Principal.SecurityIdentifier" />.</exception>
</Docs>
</Member>
<Member MemberName="AccessRuleType">
<MemberSignature Language="C#" Value="public override Type AccessRuleType { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Type AccessRuleType" />
<MemberSignature Language="DocId" Value="P:System.Security.AccessControl.FileSystemSecurity.AccessRuleType" />
<MemberSignature Language="VB.NET" Value="Public Overrides ReadOnly Property AccessRuleType As Type" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual property Type ^ AccessRuleType { Type ^ get(); };" />
<MemberSignature Language="F#" Value="member this.AccessRuleType : Type" Usage="System.Security.AccessControl.FileSystemSecurity.AccessRuleType" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Type</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the enumeration that the <see cref="T:System.Security.AccessControl.FileSystemSecurity" /> class uses to represent access rules.</summary>
<value>A <see cref="T:System.Type" /> object representing the <see cref="T:System.Security.AccessControl.FileSystemAccessRule" /> class.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Classes that derive from the <xref:System.Security.AccessControl.FileSystemSecurity> class override the <xref:System.Security.AccessControl.FileSystemSecurity.AccessRuleType%2A> property and return the type they use to represent access rules. When you work with arrays or collections that contain multiple types of security objects, use this property to determine the correct access rule type to use with each security object.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="AddAccessRule">
<MemberSignature Language="C#" Value="public void AddAccessRule (System.Security.AccessControl.FileSystemAccessRule rule);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void AddAccessRule(class System.Security.AccessControl.FileSystemAccessRule rule) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Security.AccessControl.FileSystemSecurity.AddAccessRule(System.Security.AccessControl.FileSystemAccessRule)" />
<MemberSignature Language="VB.NET" Value="Public Sub AddAccessRule (rule As FileSystemAccessRule)" />
<MemberSignature Language="C++ CLI" Value="public:
 void AddAccessRule(System::Security::AccessControl::FileSystemAccessRule ^ rule);" />
<MemberSignature Language="F#" Value="override this.AddAccessRule : System.Security.AccessControl.FileSystemAccessRule -> unit" Usage="fileSystemSecurity.AddAccessRule rule" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="rule" Type="System.Security.AccessControl.FileSystemAccessRule" />
</Parameters>
<Docs>
<param name="rule">A <see cref="T:System.Security.AccessControl.FileSystemAccessRule" /> object that represents an access control list (ACL) permission to add to a file or directory.</param>
<summary>Adds the specified access control list (ACL) permission to the current file or directory.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Security.AccessControl.FileSystemSecurity.AddAccessRule%2A> method adds a new rule to the list of rules contained within a <xref:System.Security.AccessControl.FileSystemSecurity> object.
If an access control list (ACL) already exists for the specified rule, the <xref:System.Security.AccessControl.FileSystemSecurity.AddAccessRule%2A> method will still add the rule, with one exception: a <xref:System.Security.AccessControl.FileSystemAccessRule> object created using the <xref:System.Security.AccessControl.AccessControlType.Deny> enumeration value supersedes an object created using the <xref:System.Security.AccessControl.AccessControlType.Allow> enumeration value.
To persist new or changed ACL information to a file, use the <xref:System.IO.File.SetAccessControl%2A> or <xref:System.IO.FileInfo.SetAccessControl%2A> method. To persist new or changed ACL information to a directory, use the <xref:System.IO.Directory.SetAccessControl%2A> or <xref:System.IO.FileInfo.SetAccessControl%2A> method.
To retrieve ACL information from a file, use the <xref:System.IO.File.GetAccessControl%2A> or <xref:System.IO.FileInfo.GetAccessControl%2A> method. To retrieve ACL information from a directory, use the <xref:System.IO.Directory.GetAccessControl%2A> or <xref:System.IO.DirectoryInfo.GetAccessControl%2A> method.
When you add an access rule without setting the <xref:System.Security.AccessControl.FileSystemRights.Synchronize> flag, the <xref:System.Security.AccessControl.FileSystemRights.Synchronize> flag will be automatically added to your rule. If you remove the rule later without specifying the <xref:System.Security.AccessControl.FileSystemRights.Synchronize> flag, the flag will automatically be removed.
## Examples
The following code example uses the <xref:System.Security.AccessControl.FileSecurity> class to add and then remove an access control list (ACL) entry from a file. You must supply a valid user or group account to run this example.
[!code-cpp[IO.File.GetAccessControl-SetAccessControl#1](~/samples/snippets/cpp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/cpp/sample.cpp#1)]
[!code-csharp[IO.File.GetAccessControl-SetAccessControl#1](~/samples/snippets/csharp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/CS/sample.cs#1)]
[!code-vb[IO.File.GetAccessControl-SetAccessControl#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/VB/sample.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="rule" /> parameter is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="AddAuditRule">
<MemberSignature Language="C#" Value="public void AddAuditRule (System.Security.AccessControl.FileSystemAuditRule rule);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void AddAuditRule(class System.Security.AccessControl.FileSystemAuditRule rule) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Security.AccessControl.FileSystemSecurity.AddAuditRule(System.Security.AccessControl.FileSystemAuditRule)" />
<MemberSignature Language="VB.NET" Value="Public Sub AddAuditRule (rule As FileSystemAuditRule)" />
<MemberSignature Language="C++ CLI" Value="public:
 void AddAuditRule(System::Security::AccessControl::FileSystemAuditRule ^ rule);" />
<MemberSignature Language="F#" Value="override this.AddAuditRule : System.Security.AccessControl.FileSystemAuditRule -> unit" Usage="fileSystemSecurity.AddAuditRule rule" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="rule" Type="System.Security.AccessControl.FileSystemAuditRule" />
</Parameters>
<Docs>
<param name="rule">A <see cref="T:System.Security.AccessControl.FileSystemAuditRule" /> object that represents an audit rule to add to a file or directory.</param>
<summary>Adds the specified audit rule to the current file or directory.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Security.AccessControl.FileSystemSecurity.AddAuditRule%2A> method adds a new audit rule to the list of rules contained within a <xref:System.Security.AccessControl.FileSystemSecurity> object.
If an audit rule already exists for the specified rule, the <xref:System.Security.AccessControl.FileSystemSecurity.AddAuditRule%2A> method will still add the rule.
## Examples
The following code example uses the <xref:System.Security.AccessControl.FileSystemSecurity.AddAuditRule%2A> method to add an audit rule to a file and uses the <xref:System.Security.AccessControl.FileSystemSecurity.RemoveAuditRule%2A> method to remove the audit rule from the file. You must supply a valid user or group account to run this example.
[!code-csharp[AccessControl.FileSystemAuditRule#1](~/samples/snippets/csharp/VS_Snippets_CLR/AccessControl.FileSystemAuditRule/cs/sample.cs#1)]
[!code-vb[AccessControl.FileSystemAuditRule#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/AccessControl.FileSystemAuditRule/vb/sample.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="rule" /> parameter is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="AuditRuleFactory">
<MemberSignature Language="C#" Value="public override sealed System.Security.AccessControl.AuditRule AuditRuleFactory (System.Security.Principal.IdentityReference identityReference, int accessMask, bool isInherited, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags, System.Security.AccessControl.AuditFlags flags);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance class System.Security.AccessControl.AuditRule AuditRuleFactory(class System.Security.Principal.IdentityReference identityReference, int32 accessMask, bool isInherited, valuetype System.Security.AccessControl.InheritanceFlags inheritanceFlags, valuetype System.Security.AccessControl.PropagationFlags propagationFlags, valuetype System.Security.AccessControl.AuditFlags flags) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Security.AccessControl.FileSystemSecurity.AuditRuleFactory(System.Security.Principal.IdentityReference,System.Int32,System.Boolean,System.Security.AccessControl.InheritanceFlags,System.Security.AccessControl.PropagationFlags,System.Security.AccessControl.AuditFlags)" />
<MemberSignature Language="C++ CLI" Value="public:
 override System::Security::AccessControl::AuditRule ^ AuditRuleFactory(System::Security::Principal::IdentityReference ^ identityReference, int accessMask, bool isInherited, System::Security::AccessControl::InheritanceFlags inheritanceFlags, System::Security::AccessControl::PropagationFlags propagationFlags, System::Security::AccessControl::AuditFlags flags);" />
<MemberSignature Language="F#" Value="override this.AuditRuleFactory : System.Security.Principal.IdentityReference * int * bool * System.Security.AccessControl.InheritanceFlags * System.Security.AccessControl.PropagationFlags * System.Security.AccessControl.AuditFlags -> System.Security.AccessControl.AuditRule" Usage="fileSystemSecurity.AuditRuleFactory (identityReference, accessMask, isInherited, inheritanceFlags, propagationFlags, flags)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Security.AccessControl.AuditRule</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="identityReference" Type="System.Security.Principal.IdentityReference" />
<Parameter Name="accessMask" Type="System.Int32" />
<Parameter Name="isInherited" Type="System.Boolean" />
<Parameter Name="inheritanceFlags" Type="System.Security.AccessControl.InheritanceFlags" />
<Parameter Name="propagationFlags" Type="System.Security.AccessControl.PropagationFlags" />
<Parameter Name="flags" Type="System.Security.AccessControl.AuditFlags" />
</Parameters>
<Docs>
<param name="identityReference">An <see cref="T:System.Security.Principal.IdentityReference" /> object that represents a user account.</param>
<param name="accessMask">An integer that specifies an access type.</param>
<param name="isInherited">
<see langword="true" /> if the access rule is inherited; otherwise, <see langword="false" />.</param>
<param name="inheritanceFlags">One of the <see cref="T:System.Security.AccessControl.InheritanceFlags" /> values that specifies how to propagate access masks to child objects.</param>
<param name="propagationFlags">One of the <see cref="T:System.Security.AccessControl.PropagationFlags" /> values that specifies how to propagate Access Control Entries (ACEs) to child objects.</param>
<param name="flags">One of the <see cref="T:System.Security.AccessControl.AuditFlags" /> values that specifies the type of auditing to perform.</param>
<summary>Initializes a new instance of the <see cref="T:System.Security.AccessControl.FileSystemAuditRule" /> class representing the specified audit rule for the specified user.</summary>
<returns>A new <see cref="T:System.Security.AccessControl.FileSystemAuditRule" /> object representing the specified audit rule for the specified user.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The recommended way to create audit rules is to use the constructors of the <xref:System.Security.AccessControl.FileSystemAuditRule> class.
The return type of the <xref:System.Security.AccessControl.FileSystemSecurity.AuditRuleFactory%2A> method is the base class, <xref:System.Security.AccessControl.AuditRule>, but the return value can be cast safely to the derived class.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="accessMask" />, <paramref name="inheritanceFlags" />, <paramref name="propagationFlags" />, or <paramref name="flags" /> properties specify an invalid value.</exception>
<exception cref="T:System.ArgumentNullException">The <paramref name="identityReference" /> property is <see langword="null" />.
-or-
The <paramref name="accessMask" /> property is zero.</exception>
<exception cref="T:System.ArgumentException">The <paramref name="identityReference" /> property is neither of type <see cref="T:System.Security.Principal.SecurityIdentifier" />, nor of a type such as <see cref="T:System.Security.Principal.NTAccount" /> that can be converted to type <see cref="T:System.Security.Principal.SecurityIdentifier" />.</exception>
</Docs>
</Member>
<Member MemberName="AuditRuleType">
<MemberSignature Language="C#" Value="public override Type AuditRuleType { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Type AuditRuleType" />
<MemberSignature Language="DocId" Value="P:System.Security.AccessControl.FileSystemSecurity.AuditRuleType" />
<MemberSignature Language="VB.NET" Value="Public Overrides ReadOnly Property AuditRuleType As Type" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual property Type ^ AuditRuleType { Type ^ get(); };" />
<MemberSignature Language="F#" Value="member this.AuditRuleType : Type" Usage="System.Security.AccessControl.FileSystemSecurity.AuditRuleType" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Type</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the type that the <see cref="T:System.Security.AccessControl.FileSystemSecurity" /> class uses to represent audit rules.</summary>
<value>A <see cref="T:System.Type" /> object representing the <see cref="T:System.Security.AccessControl.FileSystemAuditRule" /> class.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Classes that derive from the <xref:System.Security.AccessControl.FileSystemSecurity> class override the <xref:System.Security.AccessControl.FileSystemSecurity.AuditRuleType%2A> property and return the type they use to represent audit rights. When you work with arrays or collections that contain multiple types of security objects, use this property to determine the correct audit rule type to use with each security object.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="RemoveAccessRule">
<MemberSignature Language="C#" Value="public bool RemoveAccessRule (System.Security.AccessControl.FileSystemAccessRule rule);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance bool RemoveAccessRule(class System.Security.AccessControl.FileSystemAccessRule rule) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Security.AccessControl.FileSystemSecurity.RemoveAccessRule(System.Security.AccessControl.FileSystemAccessRule)" />
<MemberSignature Language="VB.NET" Value="Public Function RemoveAccessRule (rule As FileSystemAccessRule) As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:
 bool RemoveAccessRule(System::Security::AccessControl::FileSystemAccessRule ^ rule);" />
<MemberSignature Language="F#" Value="override this.RemoveAccessRule : System.Security.AccessControl.FileSystemAccessRule -> bool" Usage="fileSystemSecurity.RemoveAccessRule rule" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="rule" Type="System.Security.AccessControl.FileSystemAccessRule" />
</Parameters>
<Docs>
<param name="rule">A <see cref="T:System.Security.AccessControl.FileSystemAccessRule" /> object that represents an access control list (ACL) permission to remove from a file or directory.</param>
<summary>Removes all matching allow or deny access control list (ACL) permissions from the current file or directory.</summary>
<returns>
<see langword="true" /> if the access rule was removed; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Security.AccessControl.FileSystemSecurity.RemoveAccessRule%2A> method removes either all matching <xref:System.Security.AccessControl.AccessControlType.Deny> access rules or all matching <xref:System.Security.AccessControl.AccessControlType.Allow> access rules from the current <xref:System.Security.AccessControl.FileSystemSecurity> object. For example, you can use this method to remove all <xref:System.Security.AccessControl.AccessControlType.Deny> access rules for a user by passing a <xref:System.Security.AccessControl.FileSystemAccessRule> object created using the <xref:System.Security.AccessControl.AccessControlType.Deny> value, the <xref:System.Security.AccessControl.FileSystemRights.Read> value, and a user account. When you do this, the <xref:System.Security.AccessControl.FileSystemSecurity.RemoveAccessRule%2A> method removes any deny rules that specify the <xref:System.Security.AccessControl.FileSystemRights.Read> value or the <xref:System.Security.AccessControl.FileSystemRights.Write> value.
To persist new or changed access control list (ACL) information to a file, use the <xref:System.IO.File.SetAccessControl%2A> or <xref:System.IO.FileInfo.SetAccessControl%2A> method. To persist new or changed ACL information to a directory, use the <xref:System.IO.Directory.SetAccessControl%2A> or <xref:System.IO.FileInfo.SetAccessControl%2A> method.
To retrieve ACL information from a file, use the <xref:System.IO.File.GetAccessControl%2A> or <xref:System.IO.FileInfo.GetAccessControl%2A> method. To retrieve ACL information from a directory, use the <xref:System.IO.Directory.GetAccessControl%2A> or <xref:System.IO.DirectoryInfo.GetAccessControl%2A> method.
When you add an access rule without setting the <xref:System.Security.AccessControl.FileSystemRights.Synchronize> flag, the <xref:System.Security.AccessControl.FileSystemRights.Synchronize> flag will be automatically added to your rule. If you remove the rule later without specifying the <xref:System.Security.AccessControl.FileSystemRights.Synchronize> flag, the flag will automatically be removed.
## Examples
The following code example uses the <xref:System.Security.AccessControl.FileSecurity> class to add and then remove an access control list (ACL) entry from a file. You must supply a valid user or group account to run this example.
[!code-cpp[IO.File.GetAccessControl-SetAccessControl#1](~/samples/snippets/cpp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/cpp/sample.cpp#1)]
[!code-csharp[IO.File.GetAccessControl-SetAccessControl#1](~/samples/snippets/csharp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/CS/sample.cs#1)]
[!code-vb[IO.File.GetAccessControl-SetAccessControl#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/VB/sample.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="rule" /> parameter is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="RemoveAccessRuleAll">
<MemberSignature Language="C#" Value="public void RemoveAccessRuleAll (System.Security.AccessControl.FileSystemAccessRule rule);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void RemoveAccessRuleAll(class System.Security.AccessControl.FileSystemAccessRule rule) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Security.AccessControl.FileSystemSecurity.RemoveAccessRuleAll(System.Security.AccessControl.FileSystemAccessRule)" />
<MemberSignature Language="VB.NET" Value="Public Sub RemoveAccessRuleAll (rule As FileSystemAccessRule)" />
<MemberSignature Language="C++ CLI" Value="public:
 void RemoveAccessRuleAll(System::Security::AccessControl::FileSystemAccessRule ^ rule);" />
<MemberSignature Language="F#" Value="override this.RemoveAccessRuleAll : System.Security.AccessControl.FileSystemAccessRule -> unit" Usage="fileSystemSecurity.RemoveAccessRuleAll rule" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="rule" Type="System.Security.AccessControl.FileSystemAccessRule" />
</Parameters>
<Docs>
<param name="rule">A <see cref="T:System.Security.AccessControl.FileSystemAccessRule" /> object that specifies a user whose access control list (ACL) permissions should be removed from a file or directory.</param>
<summary>Removes all access control list (ACL) permissions for the specified user from the current file or directory.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Security.AccessControl.FileSystemSecurity.RemoveAccessRuleAll%2A> method removes all access control list (ACL) permissions for the specified user. The method ignores all values in the <xref:System.Security.AccessControl.FileSystemAccessRule> object except the user account.
To persist new or changed ACL information to a file, use the <xref:System.IO.File.SetAccessControl%2A> or <xref:System.IO.FileInfo.SetAccessControl%2A> method. To persist new or changed ACL information to a directory, use the <xref:System.IO.Directory.SetAccessControl%2A> or <xref:System.IO.FileInfo.SetAccessControl%2A> method.
To retrieve ACL information from a file, use the <xref:System.IO.File.GetAccessControl%2A> or <xref:System.IO.FileInfo.GetAccessControl%2A> method. To retrieve ACL information from a directory, use the <xref:System.IO.Directory.GetAccessControl%2A> or <xref:System.IO.DirectoryInfo.GetAccessControl%2A> method.
When you add an access rule without setting the <xref:System.Security.AccessControl.FileSystemRights.Synchronize> flag, the <xref:System.Security.AccessControl.FileSystemRights.Synchronize> flag will be automatically added to your rule. If you remove the rule later without specifying the <xref:System.Security.AccessControl.FileSystemRights.Synchronize> flag, the flag will automatically be removed.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="rule" /> parameter is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="RemoveAccessRuleSpecific">
<MemberSignature Language="C#" Value="public void RemoveAccessRuleSpecific (System.Security.AccessControl.FileSystemAccessRule rule);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void RemoveAccessRuleSpecific(class System.Security.AccessControl.FileSystemAccessRule rule) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Security.AccessControl.FileSystemSecurity.RemoveAccessRuleSpecific(System.Security.AccessControl.FileSystemAccessRule)" />
<MemberSignature Language="VB.NET" Value="Public Sub RemoveAccessRuleSpecific (rule As FileSystemAccessRule)" />
<MemberSignature Language="C++ CLI" Value="public:
 void RemoveAccessRuleSpecific(System::Security::AccessControl::FileSystemAccessRule ^ rule);" />
<MemberSignature Language="F#" Value="override this.RemoveAccessRuleSpecific : System.Security.AccessControl.FileSystemAccessRule -> unit" Usage="fileSystemSecurity.RemoveAccessRuleSpecific rule" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="rule" Type="System.Security.AccessControl.FileSystemAccessRule" />
</Parameters>
<Docs>
<param name="rule">A <see cref="T:System.Security.AccessControl.FileSystemAccessRule" /> object that specifies a user whose access control list (ACL) permissions should be removed from a file or directory.</param>
<summary>Removes a single matching allow or deny access control list (ACL) permission from the current file or directory.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Security.AccessControl.FileSystemSecurity.RemoveAccessRuleSpecific%2A> method removes the specified <xref:System.Security.AccessControl.AccessControlType.Deny> access rule or the specified matching <xref:System.Security.AccessControl.AccessControlType.Allow> access rule from the current <xref:System.Security.AccessControl.FileSystemSecurity> object. For example, you can use this method to remove a specified <xref:System.Security.AccessControl.AccessControlType.Deny> access rule for a user by passing a <xref:System.Security.AccessControl.FileSystemAccessRule> object created using the <xref:System.Security.AccessControl.AccessControlType.Deny> value, the <xref:System.Security.AccessControl.FileSystemRights.Read> value, and a user account. When you do this, the <xref:System.Security.AccessControl.FileSystemSecurity.RemoveAccessRuleSpecific%2A> method removes only the deny rule that specifies the <xref:System.Security.AccessControl.FileSystemRights.Read> value. It does not remove any deny rules that specify the <xref:System.Security.AccessControl.FileSystemRights.Write> value.
To persist new or changed access control list (ACL) information to a file, use the <xref:System.IO.File.SetAccessControl%2A> or <xref:System.IO.FileInfo.SetAccessControl%2A> method. To persist new or changed ACL information to a directory, use the <xref:System.IO.Directory.SetAccessControl%2A> or <xref:System.IO.FileInfo.SetAccessControl%2A> method.
To retrieve ACL information from a file, use the <xref:System.IO.File.GetAccessControl%2A> or <xref:System.IO.FileInfo.GetAccessControl%2A> method. To retrieve ACL information from a directory, use the <xref:System.IO.Directory.GetAccessControl%2A> or <xref:System.IO.DirectoryInfo.GetAccessControl%2A> method.
When you add an access rule without setting the <xref:System.Security.AccessControl.FileSystemRights.Synchronize> flag, the <xref:System.Security.AccessControl.FileSystemRights.Synchronize> flag will be automatically added to your rule. If you remove the rule later without specifying the <xref:System.Security.AccessControl.FileSystemRights.Synchronize> flag, the flag will automatically be removed.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="rule" /> parameter is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="RemoveAuditRule">
<MemberSignature Language="C#" Value="public bool RemoveAuditRule (System.Security.AccessControl.FileSystemAuditRule rule);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance bool RemoveAuditRule(class System.Security.AccessControl.FileSystemAuditRule rule) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Security.AccessControl.FileSystemSecurity.RemoveAuditRule(System.Security.AccessControl.FileSystemAuditRule)" />
<MemberSignature Language="VB.NET" Value="Public Function RemoveAuditRule (rule As FileSystemAuditRule) As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:
 bool RemoveAuditRule(System::Security::AccessControl::FileSystemAuditRule ^ rule);" />
<MemberSignature Language="F#" Value="override this.RemoveAuditRule : System.Security.AccessControl.FileSystemAuditRule -> bool" Usage="fileSystemSecurity.RemoveAuditRule rule" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="rule" Type="System.Security.AccessControl.FileSystemAuditRule" />
</Parameters>
<Docs>
<param name="rule">A <see cref="T:System.Security.AccessControl.FileSystemAuditRule" /> object that represents an audit rule to remove from a file or directory.</param>
<summary>Removes all matching allow or deny audit rules from the current file or directory.</summary>
<returns>
<see langword="true" /> if the audit rule was removed; otherwise, <see langword="false" /></returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Security.AccessControl.FileSystemSecurity.RemoveAuditRule%2A> method removes either all matching <xref:System.Security.AccessControl.AccessControlType.Deny> audit rules or all matching <xref:System.Security.AccessControl.AccessControlType.Allow> audit rules from the current <xref:System.Security.AccessControl.FileSystemSecurity> object. For example, you can use this method to remove all <xref:System.Security.AccessControl.AccessControlType.Deny> audit rules for a user by passing a <xref:System.Security.AccessControl.FileSystemAuditRule> object created using the <xref:System.Security.AccessControl.AccessControlType.Deny> value, the <xref:System.Security.AccessControl.AuditFlags.Failure> value, and a user account. When you do this, the <xref:System.Security.AccessControl.FileSystemSecurity.RemoveAuditRule%2A> method removes any deny rules that specify the <xref:System.Security.AccessControl.AuditFlags.Failure> value or the <xref:System.Security.AccessControl.AuditFlags.Success> value.
## Examples
The following code example uses the <xref:System.Security.AccessControl.FileSystemSecurity.AddAuditRule%2A> method to add an audit rule to a file and uses the <xref:System.Security.AccessControl.FileSystemSecurity.RemoveAuditRule%2A> method to remove the audit rule from the file. You must supply a valid user or group account to run this example.
[!code-csharp[AccessControl.FileSystemAuditRule#1](~/samples/snippets/csharp/VS_Snippets_CLR/AccessControl.FileSystemAuditRule/cs/sample.cs#1)]
[!code-vb[AccessControl.FileSystemAuditRule#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/AccessControl.FileSystemAuditRule/vb/sample.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="rule" /> parameter is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="RemoveAuditRuleAll">
<MemberSignature Language="C#" Value="public void RemoveAuditRuleAll (System.Security.AccessControl.FileSystemAuditRule rule);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void RemoveAuditRuleAll(class System.Security.AccessControl.FileSystemAuditRule rule) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Security.AccessControl.FileSystemSecurity.RemoveAuditRuleAll(System.Security.AccessControl.FileSystemAuditRule)" />
<MemberSignature Language="VB.NET" Value="Public Sub RemoveAuditRuleAll (rule As FileSystemAuditRule)" />
<MemberSignature Language="C++ CLI" Value="public:
 void RemoveAuditRuleAll(System::Security::AccessControl::FileSystemAuditRule ^ rule);" />
<MemberSignature Language="F#" Value="override this.RemoveAuditRuleAll : System.Security.AccessControl.FileSystemAuditRule -> unit" Usage="fileSystemSecurity.RemoveAuditRuleAll rule" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="rule" Type="System.Security.AccessControl.FileSystemAuditRule" />
</Parameters>
<Docs>
<param name="rule">A <see cref="T:System.Security.AccessControl.FileSystemAuditRule" /> object that specifies a user whose audit rules should be removed from a file or directory.</param>
<summary>Removes all audit rules for the specified user from the current file or directory.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Security.AccessControl.FileSystemSecurity.RemoveAuditRuleAll%2A> method removes all audit rules for the specified user. It ignores all values in the <xref:System.Security.AccessControl.FileSystemAuditRule> object except the user account.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="rule" /> parameter is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="RemoveAuditRuleSpecific">
<MemberSignature Language="C#" Value="public void RemoveAuditRuleSpecific (System.Security.AccessControl.FileSystemAuditRule rule);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void RemoveAuditRuleSpecific(class System.Security.AccessControl.FileSystemAuditRule rule) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Security.AccessControl.FileSystemSecurity.RemoveAuditRuleSpecific(System.Security.AccessControl.FileSystemAuditRule)" />
<MemberSignature Language="VB.NET" Value="Public Sub RemoveAuditRuleSpecific (rule As FileSystemAuditRule)" />
<MemberSignature Language="C++ CLI" Value="public:
 void RemoveAuditRuleSpecific(System::Security::AccessControl::FileSystemAuditRule ^ rule);" />
<MemberSignature Language="F#" Value="override this.RemoveAuditRuleSpecific : System.Security.AccessControl.FileSystemAuditRule -> unit" Usage="fileSystemSecurity.RemoveAuditRuleSpecific rule" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="rule" Type="System.Security.AccessControl.FileSystemAuditRule" />
</Parameters>
<Docs>
<param name="rule">A <see cref="T:System.Security.AccessControl.FileSystemAuditRule" /> object that represents an audit rule to remove from a file or directory.</param>
<summary>Removes a single matching allow or deny audit rule from the current file or directory.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Security.AccessControl.FileSystemSecurity.RemoveAuditRuleSpecific%2A> method removes the specified matching <xref:System.Security.AccessControl.AccessControlType.Deny> audit rule or the specified matching <xref:System.Security.AccessControl.AccessControlType.Allow> audit rule from the current <xref:System.Security.AccessControl.FileSystemSecurity> object. For example, you can use this method to remove a specified <xref:System.Security.AccessControl.AccessControlType.Deny> audit rule for a user by passing a <xref:System.Security.AccessControl.FileSystemAuditRule> object created using the <xref:System.Security.AccessControl.AccessControlType.Deny> value, the <xref:System.Security.AccessControl.AuditFlags.Failure> value, and a user account. When you do this, the <xref:System.Security.AccessControl.FileSystemSecurity.RemoveAuditRuleSpecific%2A> method removes only a deny rule that specifies the <xref:System.Security.AccessControl.AuditFlags.Failure> value. It does not remove any deny rules that specify the <xref:System.Security.AccessControl.AuditFlags.Success> value.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="rule" /> parameter is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="ResetAccessRule">
<MemberSignature Language="C#" Value="public void ResetAccessRule (System.Security.AccessControl.FileSystemAccessRule rule);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void ResetAccessRule(class System.Security.AccessControl.FileSystemAccessRule rule) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Security.AccessControl.FileSystemSecurity.ResetAccessRule(System.Security.AccessControl.FileSystemAccessRule)" />
<MemberSignature Language="VB.NET" Value="Public Sub ResetAccessRule (rule As FileSystemAccessRule)" />
<MemberSignature Language="C++ CLI" Value="public:
 void ResetAccessRule(System::Security::AccessControl::FileSystemAccessRule ^ rule);" />
<MemberSignature Language="F#" Value="override this.ResetAccessRule : System.Security.AccessControl.FileSystemAccessRule -> unit" Usage="fileSystemSecurity.ResetAccessRule rule" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="rule" Type="System.Security.AccessControl.FileSystemAccessRule" />
</Parameters>
<Docs>
<param name="rule">A <see cref="T:System.Security.AccessControl.FileSystemAccessRule" /> object that represents an access control list (ACL) permission to add to a file or directory.</param>
<summary>Adds the specified access control list (ACL) permission to the current file or directory and removes all matching ACL permissions.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Security.AccessControl.FileSystemSecurity.ResetAccessRule%2A> method adds the specified access control list (ACL) rule or overwrites any identical ACL rules that match the `rule` parameter. For example, if the `rule` parameter specifies a <xref:System.Security.AccessControl.FileSystemRights.Read> value and the <xref:System.Security.AccessControl.FileSystemSecurity.ResetAccessRule%2A> method finds an identical ACL rule that specifies the <xref:System.Security.AccessControl.FileSystemRights.Read> value, the identical rule will be overwritten. If the <xref:System.Security.AccessControl.FileSystemSecurity.ResetAccessRule%2A> method finds an identical ACL rule that specifies the <xref:System.Security.AccessControl.FileSystemRights.Write> value, the identical rule will also be overwritten.
To persist new or changed ACL information to a file, use the <xref:System.IO.File.SetAccessControl%2A> or <xref:System.IO.FileInfo.SetAccessControl%2A> method. To persist new or changed ACL information to a directory, use the <xref:System.IO.Directory.SetAccessControl%2A> or <xref:System.IO.FileInfo.SetAccessControl%2A> method.
To retrieve ACL information from a file, use the <xref:System.IO.File.GetAccessControl%2A> or <xref:System.IO.FileInfo.GetAccessControl%2A> method. To retrieve ACL information from a directory, use the <xref:System.IO.Directory.GetAccessControl%2A> or <xref:System.IO.DirectoryInfo.GetAccessControl%2A> method.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="rule" /> parameter is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="SetAccessRule">
<MemberSignature Language="C#" Value="public void SetAccessRule (System.Security.AccessControl.FileSystemAccessRule rule);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void SetAccessRule(class System.Security.AccessControl.FileSystemAccessRule rule) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Security.AccessControl.FileSystemSecurity.SetAccessRule(System.Security.AccessControl.FileSystemAccessRule)" />
<MemberSignature Language="VB.NET" Value="Public Sub SetAccessRule (rule As FileSystemAccessRule)" />
<MemberSignature Language="C++ CLI" Value="public:
 void SetAccessRule(System::Security::AccessControl::FileSystemAccessRule ^ rule);" />
<MemberSignature Language="F#" Value="override this.SetAccessRule : System.Security.AccessControl.FileSystemAccessRule -> unit" Usage="fileSystemSecurity.SetAccessRule rule" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="rule" Type="System.Security.AccessControl.FileSystemAccessRule" />
</Parameters>
<Docs>
<param name="rule">A <see cref="T:System.Security.AccessControl.FileSystemAccessRule" /> object that represents an access control list (ACL) permission to set for a file or directory.</param>
<summary>Sets the specified access control list (ACL) permission for the current file or directory.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Security.AccessControl.FileSystemSecurity.SetAccessRule%2A> method adds the specified access control list (ACL) rule or overwrites any identical ACL rules that match the <xref:System.Security.AccessControl.FileSystemRights> value of the `rule` parameter. For example, if the `rule` parameter specifies a <xref:System.Security.AccessControl.FileSystemRights.Read> value and the <xref:System.Security.AccessControl.FileSystemSecurity.SetAccessRule%2A> method finds an identical ACL rule that specifies the <xref:System.Security.AccessControl.FileSystemRights.Read> value, the identical rule will be overwritten. If the <xref:System.Security.AccessControl.FileSystemSecurity.SetAccessRule%2A> method finds an identical ACL rule that specifies the <xref:System.Security.AccessControl.FileSystemRights.Write> value, the identical rule will not be overwritten.
To persist new or changed ACL information to a file, use the <xref:System.IO.File.SetAccessControl%2A> or <xref:System.IO.FileInfo.SetAccessControl%2A> method. To persist new or changed ACL information to a directory, use the <xref:System.IO.Directory.SetAccessControl%2A> or <xref:System.IO.FileInfo.SetAccessControl%2A> method.
To retrieve ACL information from a file, use the <xref:System.IO.File.GetAccessControl%2A> or <xref:System.IO.FileInfo.GetAccessControl%2A> method. To retrieve ACL information from a directory, use the <xref:System.IO.Directory.GetAccessControl%2A> or <xref:System.IO.DirectoryInfo.GetAccessControl%2A> method.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="rule" /> parameter is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="SetAuditRule">
<MemberSignature Language="C#" Value="public void SetAuditRule (System.Security.AccessControl.FileSystemAuditRule rule);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void SetAuditRule(class System.Security.AccessControl.FileSystemAuditRule rule) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Security.AccessControl.FileSystemSecurity.SetAuditRule(System.Security.AccessControl.FileSystemAuditRule)" />
<MemberSignature Language="VB.NET" Value="Public Sub SetAuditRule (rule As FileSystemAuditRule)" />
<MemberSignature Language="C++ CLI" Value="public:
 void SetAuditRule(System::Security::AccessControl::FileSystemAuditRule ^ rule);" />
<MemberSignature Language="F#" Value="override this.SetAuditRule : System.Security.AccessControl.FileSystemAuditRule -> unit" Usage="fileSystemSecurity.SetAuditRule rule" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="rule" Type="System.Security.AccessControl.FileSystemAuditRule" />
</Parameters>
<Docs>
<param name="rule">A <see cref="T:System.Security.AccessControl.FileSystemAuditRule" /> object that represents an audit rule to set for a file or directory.</param>
<summary>Sets the specified audit rule for the current file or directory.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Security.AccessControl.FileSystemSecurity.SetAuditRule%2A> method adds the specified audit rule or overwrites any identical audit rules that match the <xref:System.Security.AccessControl.FileSystemRights> value of the `rule` parameter. For example, if the `rule` parameter specifies a <xref:System.Security.AccessControl.FileSystemRights.Read> value and the <xref:System.Security.AccessControl.FileSystemSecurity.SetAuditRule%2A> method finds an identical audit rule that specifies the <xref:System.Security.AccessControl.FileSystemRights.Read> value, the identical rule will be overwritten. If the <xref:System.Security.AccessControl.FileSystemSecurity.SetAuditRule%2A> method finds an identical audit rule that specifies the <xref:System.Security.AccessControl.FileSystemRights.Write> value, the identical rule will not be overwritten.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="rule" /> parameter is <see langword="null" />.</exception>
</Docs>
</Member>
</Members>
</Type>