AFCategory Class
- Last UpdatedJan 12, 2026
- 8 minute read
- PI System
- AF SDK 3.2.0
- Developer

Inheritance Hierarchy
Namespace: OSIsoft.AF
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.2.0.7
Syntax
[SerializableAttribute] public sealed class AFCategory : AFObject, IAFTransactable, IAFChangedEvent, IAFSecurable, IComparable<AFCategory>
<SerializableAttribute> Public NotInheritable Class AFCategory Inherits AFObject Implements IAFTransactable, IAFChangedEvent, IAFSecurable, IComparable(Of AFCategory) Dim instance As AFCategory
[SerializableAttribute] public ref class AFCategory sealed : public AFObject, IAFTransactable, IAFChangedEvent, IAFSecurable, IComparable<AFCategory^>
[<SealedAttribute>] [<SerializableAttribute>] type AFCategory = class inherit AFObject interface IAFTransactable interface IAFChangedEvent interface IAFSecurable interface IComparable<AFCategory> end
The AFCategory type exposes the following members.
Constructors
| Name | Description | |
|---|---|---|
| AFCategory |
Initializes a new instance of the class with default values.
| |
| AFCategory(String) |
Initializes a new instance of the class with the specified name.
|
Properties
| Name | Description | |
|---|---|---|
| CheckOutInfo |
This read-only property returns the checked out status information for the object.
| |
| Database |
This read-only property returns the AFDatabase where this object is defined.
| |
| Description |
Read/write property that provides a more detailed description of the object.
| |
| ID |
Read-only property that provides a unique identifier for the object to be used for
quick access that is not dependent upon the index.
(Inherited from AFObject.) | |
| Identity |
This read-only property contains identity of the object.
(Inherited from AFObject.) | |
| IsDeleted |
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.) | |
| IsDirty |
This read-only property indicates whether the object has been modified since the
last save to the PI AF Server.
| |
| IsNew |
This read-only property indicates whether the object is new and has never been saved
to the PI AF Server.
| |
| Name |
Read/write property that identifies the name of the object.
| |
| None |
An AFCategory that represents no category.
| |
| PISystem |
This read-only property allows access to the PISystem associated with this
object.
(Inherited from AFObject.) | |
| Security |
This read-only property returns the AFSecurity information for the object.
| |
| UniqueID |
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.) |
Methods
| Name | Description | |
|---|---|---|
| ApplyChanges |
This method applies the changes to the object and makes
those changes available to other objects for the current user.
| |
| CheckIn |
This method checks in (commits) all the changes to the object by saving
the information to persistent storage.
| |
| CheckOut |
This method locks the object so that its configuration can be modified.
| |
| CheckOutCategories |
Check out the objects with the specified unique identifiers at the specified query date.
| |
| CompareTo(Object) |
Compares this instance with a specified Object.
(Inherited from AFObject.) | |
| CompareTo(AFObject) |
Compares this instance with a specified AFObject.
(Inherited from AFObject.) | |
| DeleteCategories |
Delete the objects with the specified unique identifiers.
| |
| Equals(Object) |
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.) | |
| Equals(AFObject) |
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.) | |
| FindCategory |
Retrieves the AFCategory object with the specified unique identifier.
| |
| GetHashCode |
Gets the hash code for this instance of the object which is suitable for use in hashing
algorithms and data structures like a hash table.
(Inherited from AFObject.) | |
| GetPath |
Returns the full path to the object, using just the names.
(Inherited from AFObject.) | |
| GetPath(AFObject) |
Returns the path to the object relative from another object.
(Inherited from AFObject.) | |
| GetPath(AFEncodeType, AFObject) |
Returns the path to the object relative from another object,
using the name and/or id as specified
by encodeType.
(Inherited from AFObject.) | |
| GetSecurity |
Gets the AFSecurity information of the specified security item
associated with the object.
| |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| LoadCategories |
Loads the AFCategory objects with the specified unique identifiers.
| |
| Persist |
This method returns the persistence string for the object.
(Inherited from AFObject.) | |
| Refresh |
Refreshes the client with any changes that have been made to the object since loaded.
| |
| ToString |
Returns a String that represents the current object.
(Inherited from AFObject.) | |
| UndoCheckOut |
This method discards all the changes to the object and all sub-objects since the
last call to CheckOut. Any changes since the check out will be lost.
|
Events
| Name | Description | |
|---|---|---|
| Changed |
Event is raised when the object or one of its sub-objects is changed.
|
Remarks
The collections of available categories are maintained by the AFDatabase. There are separate collections of categories defined for the following objects: AFElementTemplateAFBaseElement, AFAttributeTemplate, AFAttribute, AFReferenceType, AFTable, AFAnalysisTemplate, and AFAnalysis. The AFDatabase.ElementCategories collection is used for AFElementTemplate objects and all derived objects of AFBaseElement. The AFDatabase.AnalysisCategories collection is used for AFAnalysisTemplate and AFAnalysis objects.
Create a new AFCategory object by calling one of the AFCategoriesAdd methods of the desired collection maintained by the AFDatabase.
Examples
// This example demonstrates how to create an element category and display its information. // It also shows how to set the category for an element template. // Get the Database PISystems myPISystems = new PISystems(); AFDatabase myDB = myPISystems.DefaultPISystem.Databases.DefaultDatabase; // Create the Category AFCategory myCategory = myDB.ElementCategories.Add("MyElementCategory"); myCategory.Description = "This is my Element Category"; // Display the Name and Description of the Category Console.WriteLine("Name of Category = {0}", myCategory.Name); Console.WriteLine("Description = {0}", myCategory.Description); // Create an Element Template AFElementTemplate myElemTemplate = myDB.ElementTemplates.Add("MyElementTemplate"); // Set the Category for an Element Template myElemTemplate.Categories.Add(myCategory);