0

How to check whether a user is having access permission for a file or not in Microsoft Dynamics Ax 2009 with X++?

Revathi
  • 53
  • 1
  • 7

1 Answers1

0

FileIoPermission class is used to ensure that the code has access to a file before performing any IO. Here is the code sample from MSDN

The following code example shows a new instance of the FileIoPermission class that specifies read access for the File.txt file.

The assert method is called to declare that the code can then call the AsciiIo.new method.

server static void main(Args args)
{
    FileIoPermission _perm;
    AsciiIo a;

    ;

    _perm = new FileIoPermission("c:\\File.txt",'r');
    _perm.assert();

    // Invoke the protected API.
    a = new AsciiIo("c:\\File.txt",'r');
}
Babar
  • 2,786
  • 3
  • 25
  • 35