PIIdentityMappings Class
- Last UpdatedJan 12, 2026
- 6 minute read
- PI System
- AF SDK 3.2.0
- Developer
The PIIdentityMappings collection represents the available
PIIdentityMapping objects on a particular PIServer.

Inheritance Hierarchy
SystemObject
OSIsoft.AF.PIPIIdentityMappings
OSIsoft.AF.PIPIIdentityMappings
Namespace: OSIsoft.AF.PI
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.2.0.7
Syntax
public sealed class PIIdentityMappings : IList<PIIdentityMapping>, ICollection<PIIdentityMapping>, IEnumerable<PIIdentityMapping>, IEnumerable, IList, ICollection
Public NotInheritable Class PIIdentityMappings Implements IList(Of PIIdentityMapping), ICollection(Of PIIdentityMapping), IEnumerable(Of PIIdentityMapping), IEnumerable, IList, ICollection Dim instance As PIIdentityMappings
public ref class PIIdentityMappings sealed : IList<PIIdentityMapping^>, ICollection<PIIdentityMapping^>, IEnumerable<PIIdentityMapping^>, IEnumerable, IList, ICollection
[<SealedAttribute>] type PIIdentityMappings = class interface IList<PIIdentityMapping> interface ICollection<PIIdentityMapping> interface IEnumerable<PIIdentityMapping> interface IEnumerable interface IList interface ICollection end
The PIIdentityMappings type exposes the following members.
Properties
| Name | Description | |
|---|---|---|
| Count |
Gets the number of items actually contained in the collection.
| |
| ItemInt32 |
Gets or sets the item at the specified index.
| |
| ItemString |
Returns the specified object from the collection by name.
| |
| Server |
The PIServer for this PIPointClasses collection.
|
Methods
| Name | Description | |
|---|---|---|
| Add(String, String, String) |
Creates a new PIIdentityMapping with the passed in name.
| |
| Add(String, String, String, PIIdentityMappingType) |
Creates a new PIIdentityMapping with the passed in name.
| |
| Contains(String) |
This method determines whether the collection contains a specific item referenced by name.
| |
| Contains(PIIdentityMapping) |
This method determines whether the collection contains a specific item.
| |
| CopyTo |
Copies the entire collection to a compatible one-dimensional Array,
starting at the specified index of the target array.
| |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
| GetEnumerator |
Returns an enumerator that iterates through the collection.
| |
| GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| IndexOf |
Searches for the specified object and returns the zero-based index of the first
occurrence within the entire collection.
| |
| Refresh |
Refresh the collection by loading from the PIServer.
| |
| Remove(String) |
Removes a PIIdentityMapping from the PI Data Archive by name
| |
| Remove(PIIdentityMapping) |
Removes a PIIdentityMapping from the PI Data Archive
| |
| ToString | Returns a string that represents the current object. (Inherited from Object.) |
Extension Methods
| Name | Description | |
|---|---|---|
| ChunkedByPIIdentityMapping |
This extension method breaks up search results into chunks to make it easier to
page through and process IEnumerableT collections in chunks.
(Defined by AFSDKExtension.) |
Exceptions
| Exception | Condition |
|---|---|
| PIVersionNotSupportedException | This exception will be generated if PIServer does not support PIIdentityMapping. |
Remarks
This is the collection of available PIIdentityMapping objects
on a particular PIServer. Each PIIdentityMapping
object provides the mapping from a Windows user or group to a
PIIdentity on the PI Data Archive.
Examples
// Get the PIIdentityMappings from the PIServer on the local computer PISystems myPISystems = new PISystems(); PISystem myPISystem = myPISystems.DefaultPISystem; PIServer myPIServer = PIServer.FindPIServer(myPISystem, piServerName); // Display information about each PIIdentityMapping and its properties PIIdentityMappings mappings = myPIServer.IdentityMappings; Console.WriteLine("Found {0} identity mappings", mappings.Count); foreach (PIIdentityMapping mapping in mappings) { Console.WriteLine(mapping.Name); Console.WriteLine(" ID: {0}", mapping.ID); Console.WriteLine(" Description: {0}", mapping.Description); Console.WriteLine(" Principal: {0}", mapping.Principal); Console.WriteLine(" PrincipalName: {0}", mapping.PrincipalName); Console.WriteLine(" Identity: {0}", mapping.Identity); Console.WriteLine(" IdentityMappingType: {0}", mapping.IdentityMappingType); Console.WriteLine(" IsEnabled: {0}", mapping.IsEnabled); Console.WriteLine(); } // Add a mapping, if it does not yet exist. string newMapName = "PIIdentityMappingTestExample"; string mapDomainUser = QAConfig.TestAccountNoMapping; string identity = "piusers"; PIIdentityMapping newMap; if (!mappings.Contains(newMapName)) { // Note that adding or editing a mapping requires 'CheckIn' in order to commit it to the PI Data Archive. newMap = mappings.Add(newMapName, mapDomainUser, identity); newMap.CheckIn(); } else newMap = mappings[newMapName]; Console.WriteLine(newMap.Name); Console.WriteLine(" ID: {0}", newMap.ID); Console.WriteLine(" Description: {0}", newMap.Description); Console.WriteLine(" Principal: {0}", newMap.Principal); Console.WriteLine(" PrincipalName: {0}", newMap.PrincipalName); Console.WriteLine(" Identity: {0}", newMap.Identity); Console.WriteLine(" IdentityMappingType: {0}", newMap.IdentityMappingType); Console.WriteLine(" IsEnabled: {0}", newMap.IsEnabled); Console.WriteLine(); // Edit a mapping. newMap.Description = "This is a PIIdentityMapping for Test Example"; newMap.CheckIn(); Console.WriteLine(newMap.Name); Console.WriteLine(" Description: {0}", newMap.Description); Console.WriteLine(); // Delete a mapping. // Note that the 'Remove' call will be directly committed to the PI Data Archive. mappings.Remove(newMap);