FileIOPermission

Table A-4 shows the required FileIOPermission settings for PowerScript system functions in Windows Forms targets.

For Web Forms targets, file-releated functions require Read, Write, Append and PathDiscovery permissions on the appname_root directory. For print-related functions, you must set the PrintingPermission value to AllPrinting, in addition to setting Read, Write, and PathDiscover permissions on the appname_root/print directory.

Table A-4: FileIOPermission required for system functions in Windows Forms

System function

Permission required

AddToLibraryList, DirectoryExists, FileEncoding, FileExists, FileLength, FileLength64, FileRead, FileReadEx, FileSeek , FileSeek64, LibraryDirectory , LibraryDirectoryEx, LibraryExport, PrintBitmap, ProfileInt , ProfileString, SetProfileString, SetLibraryList, ShowHelp, ShowPopupHelp, XMLParseFile

Read

FileWrite, FileWriteEx, RemoveDirectory, LibraryCreate, LibraryDelete, LibraryImport

Write

FileDelete

Read and Write

FileOpen

When the FileAccess argument is Read!

  • Read permission for file named in FileName (first) argument

When the FileAccess argument is Write!

  • Append and Write permission when the WriteMode argument is Append!

  • Read and Write permission when the WriteMode argument is Replace!

FileCopy (string s, string t)

Read for the source file (first) argument; Write for the target file (second) argument

FileMove (string s, string t)

Read and Write for the source file (first) argument; Write for the target file (second) argument

GetFolder

Unrestricted

GetCurrentDirectory

PathDiscovery for the current directory

CreateDirectory (string d)

Read for the parent directory; Write for the directory name argument

Table A-5 shows the required FileIOPermission settings for object and control functions in Windows Forms targets.

Table A-5: FileIOPermission required for object or control functions in Windows Forms

Object or control

Function or property

Permission required

Animation

AnimationName

Read

DataWindow

SaveAsAscii , SaveAsFormattedText , SavInk , SaveInkPicture

Write

ImportFile

Read permission if the (usually second) file name argument is supplied; if file name argument is empty or null, requires OpenSave FileDialogPermission and Unrestricted FileIOPermission

SaveAs

Write permission if the (usually second) file name argument is supplied; if file name argument is empty or null, requires OpenSave FileDialogPermission and Unrestricted FileIOPermission

DataWindow (RichText only)

InsertDocument

Read

DataStore

ImportFile

Read

SaveAs, SaveAsAscii , SaveAsFormattedText , SavInk , SaveInkPicture

Write

DragObject

DragIcon property

Read

DropDownListBox, ListBox

DirList (string s, uint filetype)

Read and PathDiscovery for the file specification (first) argument

DropDownPictureListBox, PictureListBox

AddPicture, and PictureName property

Read

DirList (string s, uint filetype)

Read and PathDiscovery for the file specification (first) argument

Graph

ImportFile

Read

SaveAs

Unrestricted for function with no arguments; Write on the file name (first) argument for function with arguments

InkPicture

PictureFileName property

Read

LoadInk

Read and Write for the file (first) argument

LoadPicture

Read for the file (first) argument

Save, SaveInk

Write for the file (first) argument and for the current temporary file directory

Listview

AddLargePicture, AddSmallPicture, AddStatePicture, and LargePictureName, SmallPictureName, StatePictureName properties

Read

Picture

PictureName

Read

PictureButton

DisabledName, PictureName properties

Read

RichTextEdit

InsertDocument, InsertPicture

Read

SaveDocument

Write

Treeview

AddPicture, AddStatePicture, and PictureName, StatePictureName properties

Read

UserObject

PictureName property

Read

Example 1

The following XML example gives Read access to two files and write access to one of those files:

<IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="d:\test.txt;c:\demo.jpg" Write="c:\demo.jpg" />

Example 2

The following example for a Web Forms application grants Read, Write, Append, and PathDiscovery permissions to the main deployment and root directories for the MyWebApp application:

<IPermission class="FileIOPermission" version="1" Read="MyWebApp_root;MyWebApp" Write="MyWebApp_root;MyWebApp" Append="MyWebApp_root;MyWebApp" PathDiscovery="MyWebApp_root;MyWebApp"/>