This documentation is archived and is not being maintained.

FileIOPermission.AllLocalFiles Property

Gets or sets the permitted access to all local files.

[Visual Basic]
Public Property AllLocalFiles As FileIOPermissionAccess
[C#]
public FileIOPermissionAccess AllLocalFiles {get; set;}
[C++]
public: __property FileIOPermissionAccess get_AllLocalFiles();
public: __property void set_AllLocalFiles(FileIOPermissionAccess);
[JScript]
public function get AllLocalFiles() : FileIOPermissionAccess;
public function set AllLocalFiles(FileIOPermissionAccess);

Property Value

The set of file I/O flags for all local files.

Remarks

Local files are files contained on the local computer. Any files not accessed through a network drive are local files.

An individual FileIOPermissionAccess value can be checked for using a bitwise AND operation.

Example

[Visual Basic] 
' The AllFiles property gets or sets the permitted access to all files.
' The AllLocalFiles property gets or sets the permitted access to all local files.
Private Function AllFilesDemo() As Boolean
    Try
        Console.WriteLine("********************************************************" & ControlChars.Lf)

        Dim fileIOPerm1 As FileIOPermission
        Console.WriteLine("Creating a FileIOPermission and adding read access for all files")
        fileIOPerm1 = New FileIOPermission(FileIOPermissionAccess.AllAccess, "C:\Examples\Test\TestFile.txt")
        fileIOPerm1.AllFiles = FileIOPermissionAccess.Read
        Console.WriteLine("AllFiles access = " & fileIOPerm1.AllFiles.ToString())
        Console.WriteLine("Adding AllAccess rights for local files.")
        fileIOPerm1.AllLocalFiles = FileIOPermissionAccess.AllAccess
        Console.WriteLine("AllLocalFiles access = " & fileIOPerm1.AllLocalFiles.ToString())

    Catch e As ArgumentException
        Console.WriteLine(e.ToString())
        Return False
    End Try

    Return True
End Function 'AllFilesDemo


[C#] 
// The AllFiles property gets or sets the permitted access to all files.
// The AllLocalFiles property gets or sets the permitted access to all local files.
    private bool AllFilesDemo()
    {
        try
        {
            Console.WriteLine("********************************************************\n");

            FileIOPermission fileIOPerm1;
            Console.WriteLine("Creating a FileIOPermission and adding read access for all files");
            fileIOPerm1 = new FileIOPermission(FileIOPermissionAccess.AllAccess, "C:\\Examples\\Test\\TestFile.txt");
            fileIOPerm1.AllFiles = FileIOPermissionAccess.Read;
            Console.WriteLine("AllFiles access = " + fileIOPerm1.AllFiles);
            Console.WriteLine("Adding AllAccess rights for local files.");
            fileIOPerm1.AllLocalFiles = FileIOPermissionAccess.AllAccess;
            Console.WriteLine("AllLocalFiles access = " + fileIOPerm1.AllLocalFiles);

        }
        catch (ArgumentException e)
        {
            Console.WriteLine(e);
            return false;
        }

        return true;        
    }

[C++] 
// The AllFiles property gets or sets the permitted access to all files.
// The AllLocalFiles property gets or sets the permitted access to all local files.
private:
bool AllFilesDemo()
{
    try
    {
        Console::WriteLine(S"********************************************************\n");

        FileIOPermission* fileIOPerm1;
        Console::WriteLine(S"Creating a FileIOPermission and adding read access for all files");
        fileIOPerm1 = new FileIOPermission(FileIOPermissionAccess::AllAccess, S"C:\\Examples\\Test\\TestFile.txt");
        fileIOPerm1->AllFiles = FileIOPermissionAccess::Read;
        Console::WriteLine(S"AllFiles access = {0}", __box(fileIOPerm1->AllFiles));
        Console::WriteLine(S"Adding AllAccess rights for local files.");
        fileIOPerm1->AllLocalFiles = FileIOPermissionAccess::AllAccess;
        Console::WriteLine(S"AllLocalFiles access = {0}", __box(fileIOPerm1->AllLocalFiles));

    }
    catch (ArgumentException* e)
    {
        Console::WriteLine(e);
        return false;
    }

    return true;        
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

FileIOPermission Class | FileIOPermission Members | System.Security.Permissions Namespace

Show: