Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

AFAdmin.SetFileOptions Method

  • Last UpdatedNov 18, 2025
  • 3 minute read
AFAdmin.SetFileOptions Method
Sets the file options used to validate an AFFile stored in the PISystem.

Namespace:  OSIsoft.AF.Diagnostics
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public static void SetFileOptions(
	PISystem system,
	IList<string> allowedFileExtensions,
	int maxFileLength
)
Public Shared Sub SetFileOptions ( 
	system As PISystem,
	allowedFileExtensions As IList(Of String),
	maxFileLength As Integer
)

Dim system As PISystem
Dim allowedFileExtensions As IList(Of String)
Dim maxFileLength As Integer

AFAdmin.SetFileOptions(system, allowedFileExtensions, 
	maxFileLength)
public:
static void SetFileOptions(
	PISystem^ system, 
	IList<String^>^ allowedFileExtensions, 
	int maxFileLength
)
static member SetFileOptions : 
        system : PISystem * 
        allowedFileExtensions : IList<string> * 
        maxFileLength : int -> unit 

Parameters

system
Type: OSIsoft.AFPISystem
The operation will be performed on the specified PISystem.
allowedFileExtensions
Type: System.Collections.GenericIListString
The new setting for the FileAllowedExtensions list. Specify or an empty list to clear the list and allow all file extensions.
maxFileLength
Type: SystemInt32
The new setting for the FileMaxLength. This is the maximum allowed file size for an AFFile in megabytes. If less than or equal to zero, then all files are blocked.

Exceptions

ExceptionCondition
SecurityException This exception is thrown when attempting to execute without Admin security rights.
ArgumentNullException This exception is thrown when attempting to execute on a PISystem that is null or deleted.
NotSupportedException This exception is thrown when attempting to execute on a PISystem that does not support the AdminFunctionality feature.

Remarks

This method will change the FileAllowedExtensions and FileMaxLength settings that are used to validate an AFFile stored in the PISystem. To add or remove file extensions from the current list, first the current FileAllowedExtensions, list and make changes to that list, and the pass the updated list to this method.

Use the PISystem.Supports method to check if the PISystem supports the AdminFunctionality feature.

Security note Security Note
Requires the Admin right to execute.
Note Notes to Callers
This method will error on servers before AF 2018 R2 (2.10.5).

Version Information

AFSDK

Supported in: 3.1.1, 3.1.0, 3.0.2, 3.0.1, 3.0.0, 2.10.11, 2.10.5

See Also

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in