AFAdmin.SetFileOptions Method
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
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
| Exception | Condition |
|---|---|
| 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.
| Requires the Admin right to execute. |
| This method will error on servers before AF 2018 R2 (2.10.5). |