Click or drag to resize
OSIsoft, LLC

PIIdentityMapping Class

The PIIdentityMapping object represents a mapping between Windows identity and PIIdentity on a PIServer.

Inheritance Hierarchy
SystemObject
  OSIsoft.AF.PIPIIdentityMapping

Namespace:  OSIsoft.AF.PI
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 2.10.6.195
Syntax
public sealed class PIIdentityMapping : IComparable, 
	IComparable<PIIdentityMapping>, IEquatable<PIIdentityMapping>

The PIIdentityMapping type exposes the following members.

Properties
  NameDescription
Public propertyDescription
Read/write property that provides a description of the PIIdentityMapping.
Public propertyID
This read-only property provides a unique identifier for the PIIdentityMapping on the PIServer.
Public propertyIdentity
This property identifies the Name of the PIIdentity this mapping is associated with.
Public propertyIdentityMappingType
This read-only property identifies the type of PIIdentityMapping. Currently, only Windows is supported.
Public propertyIsDeleted
This read-only property indicates whether the object has been deleted.
Public propertyIsDirty
This read-only property indicates whether the object has been modified since the last save to the PI Data Archive.
Public propertyIsEnabled
This property determines if the PIIdentityMapping is enabled on the PIServer.
Public propertyIsNew
This read-only property indicates whether the object has been modified since the last save to the PI Data Archive.
Public propertyName
This property defines the name of the PIIdentityMapping.
Public propertyPrincipal
This read-only property identifies the principal of a PIIdentityMapping. For the case of Windows mapping, the Principal is a Windows SID.
Public propertyPrincipalName
This read-only property identifies the principal name of a PIIdentityMapping. For the case of Windows mapping, the PrincipalName is the Windows Account Name.
Public propertyServer
The PIServer for this PIIdentityMapping.
Top
Methods
  NameDescription
Public methodCheckIn
This method checks in (commits) all the changes to the object by saving the information to PI Data Archive.
Public methodCompareTo(Object)
Compares this instance with a specified Object.
Public methodCompareTo(PIIdentityMapping)
Compares this instance with a specified PIIdentityMapping.
Public methodEquals(Object)
Determines whether the specified Object is equal to the current object.
(Overrides ObjectEquals(Object).)
Public methodEquals(PIIdentityMapping)
Indicates whether the current object is equal to another object of the same type.
Public methodGetHashCode
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.
(Overrides ObjectGetHashCode.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a String that represents the current object.
(Overrides ObjectToString.)
Top
Operators
  NameDescription
Public operatorStatic memberEquality
The equality operator (==) compares its operands to determine if they are equal.
Public operatorStatic memberGreaterThan
The greater than relation operator (>) compares its operands to determine which one is greater than the other.
Public operatorStatic memberGreaterThanOrEqual
The greater than or equal relation operator (>=) compares its operands to determine which one is greater than or equal to the other.
Public operatorStatic memberInequality
The inequality operator (!=) compares its operands to determine if they are not equal.
Public operatorStatic memberLessThan
The less than relation operator (<) compares its operands to determine which one is less than the other.
Public operatorStatic memberLessThanOrEqual
The less than or equal relation operator (<=) compares its operands to determine which one is less than or equal to the other.
Top
Remarks
A mapping creates an association between an entity on Windows (such as an Active Directory Group) with a PIIdentity on the PI Data Archive. An identity may be of type PI identity, PI User, or PI Group.
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 = "osi\\AFTeamRDA";
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);
Version Information

AFSDK

Supported in: 2.10.5, 2.10, 2.9.5, 2.9, 2.8.5, 2.8, 2.7.5, 2.7, 2.6
See Also
Enabling Operational Intelligence