When dealing with asserting access permissions, a simple line of code may be sufficient. For example like this:
new FileIOPermission(myfilename, 'r').assert();
Above line may be used for assigning rights for reading a CSV file with Ax, with the ASCIIIO class.
But sometimes, this ain't enough and you need to assign more permissions. If you just combine statements like the one above, you may run into following error:
Multiple calls of CodeAccessPermission.Assert
Ax does not support multiple, successive calls to assert in the same calling code. You either have to use the revertAssert method (in between calls), or use assertMultiple.
An example of this last method:
Set permissionSet;
permissionSet = new Set(Types::Class);
permissionSet.add(new InteropPermission(InteropKind::ClrInterop));
permissionSet.add(new FileIOPermission(myfilename1, 'r'));
permissionSet.add(new FileIOPermission(myfilename2, 'rw'));
CodeAccessPermission::assertMultiple(permissionSet);
// do your thing
CodeAccessPermission::revertAssert();
Monday, November 9, 2009
Subscribe to:
Post Comments (Atom)
Solved my problem! Thankyou!
ReplyDeleteexactly what i was looking for. thank you
ReplyDeleteExcellent! Thank you.
ReplyDeleteGood thanks..
ReplyDeleteStill usefull in 2017 :-)
ReplyDeleteHi sir ,
ReplyDeletecan you give some idea to select and update the records in the external database through the X++