LDAP Client.Net

AttributeCollection.Add Method 

Insert a new attribute into the directory with a string value.

[Visual Basic]
MustOverride Public Function Add( _ 
   ByVal attributeName As String, _ 
   ByVal value As String _ 
) As Attribute
[C#]
public abstract Attribute Add(
   string attributeName,
   string value
);
[C++]
public: abstract Attribute* Add(
   String* attributeName,
   String* value
);
[JScript]
public abstract function Add(
   String attributeName,
   String value
): Attribute;

Parameters

attributeName
Name of the attribute.
value
Value of the attribute.

Return Value

New attribute.

Example

[C#]
using System;
using LdapServices.Ldap;

namespace LDAPSampleCodeConsole
{
class SampleApp
{
static void Main(string[] args)
{
Client client = new Client();

// Connect to the directory
client.Connect("directory.yourCompany.ca");

// Retrieve an entry to add an attribute
EntryCollection entries = client.Search("ou=people,o=yourCompany,c=ca", "cn=Jane");

// Insert a new attribute into the directory with a string value
AttributeCollection attributes = entries[0].Attributes;
attributes.Add("mail", "jane@yourCompany.ca");

// Disconnect
client.Disconnect();
}
}
}

See Also

AttributeCollection Class | LdapServices.Ldap Namespace