AFAdmin.SetID 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 Guid SetID( PISystem system, Guid? newId = null )
Public Shared Function SetID ( system As PISystem, Optional newId As Guid? = Nothing ) As Guid Dim system As PISystem Dim newId As Guid? Dim returnValue As Guid returnValue = AFAdmin.SetID(system, newId)
public: static Guid SetID( PISystem^ system, Nullable<Guid> newId = nullptr )
static member SetID : system : PISystem * ?newId : Nullable<Guid> (* Defaults: let _newId = defaultArg newId null *) -> Guid
Parameters
- system
- Type: OSIsoft.AFPISystem
The operation will be performed on the specified PISystem. - newId (Optional)
- Type: SystemNullableGuid
The new Guid for the ID of the PISystem. If not specified or , then a new Guid will be allocated.
Return Value
Type: GuidThe new value for the ID of the PISystem.
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 ID for the PISystem to the specified Guid. If the newId is not specified, then a new Guid will be allocated and returned from the method call. For an AFCollective, this method will set the ID of the currently connected AFCollectiveMember.
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). |