Table of Contents

Class Contact

Namespace
Microsoft.Exchange.WebServices.Data
Assembly
Microsoft.Exchange.WebServices.dll

Represents a contact. Properties available on contacts are defined in the ContactSchema class.

public class Contact : Item
Inheritance
Contact
Inherited Members

Constructors

Contact(ExchangeService)

Initializes an unsaved local instance of Contact. To bind to an existing contact, use Contact.Bind() instead.

public Contact(ExchangeService service)

Parameters

service ExchangeService

The ExchangeService object to which the contact will be bound.

Properties

Alias

Gets the Alias from the directory

public string Alias { get; }

Property Value

string

AssistantName

Gets or sets the contact's assistant name.

public string AssistantName { get; set; }

Property Value

string

Birthday

Gets or sets the birthday of the contact.

public DateTime? Birthday { get; set; }

Property Value

DateTime?

BusinessHomePage

Gets or sets the business home page of the contact.

public string BusinessHomePage { get; set; }

Property Value

string

Children

Gets or sets a list of children for the contact.

public StringList Children { get; set; }

Property Value

StringList

Companies

Gets or sets a list of companies for the contact.

public StringList Companies { get; set; }

Property Value

StringList

CompanyName

Gets or sets the compnay name of the contact.

public string CompanyName { get; set; }

Property Value

string

CompleteName

Gets the complete name of the contact.

public CompleteName CompleteName { get; }

Property Value

CompleteName

ContactSource

Gets the source of the contact.

public ContactSource? ContactSource { get; }

Property Value

ContactSource?

Department

Gets or sets the department of the contact.

public string Department { get; set; }

Property Value

string

DirectReports

Get the direct reports mailbox information

public EmailAddressCollection DirectReports { get; }

Property Value

EmailAddressCollection

DirectoryId

Gets the DirectoryID as Guid or DN string

public string DirectoryId { get; }

Property Value

string

DirectoryPhoto

Gets the Photo from the directory

public byte[] DirectoryPhoto { get; }

Property Value

byte[]

DisplayName

Gets or sets the display name of the contact.

public string DisplayName { get; set; }

Property Value

string

EmailAddresses

Gets an indexed list of e-mail addresses for the contact. For example, to set the first e-mail address, use the following syntax: EmailAddresses[EmailAddressKey.EmailAddress1] = "john.doe@contoso.com"

public EmailAddressDictionary EmailAddresses { get; }

Property Value

EmailAddressDictionary

FileAs

Gets or set the name under which this contact is filed as. FileAs can be manually set or can be automatically calculated based on the value of the FileAsMapping property.

public string FileAs { get; set; }

Property Value

string

FileAsMapping

Gets or sets a value indicating how the FileAs property should be automatically calculated.

public FileAsMapping FileAsMapping { get; set; }

Property Value

FileAsMapping

Generation

Gets or sets the generation of the contact.

public string Generation { get; set; }

Property Value

string

GivenName

Gets or sets the given name of the contact.

public string GivenName { get; set; }

Property Value

string

HasPicture

Gets a value indicating whether this contact has a picture associated with it.

public bool HasPicture { get; }

Property Value

bool

ImAddresses

Gets an indexed list of Instant Messaging addresses for the contact. For example, to set the first IM address, use the following syntax: ImAddresses[ImAddressKey.ImAddress1] = "john.doe@contoso.com"

public ImAddressDictionary ImAddresses { get; }

Property Value

ImAddressDictionary

Initials

Gets or sets the initials of the contact.

public string Initials { get; set; }

Property Value

string

JobTitle

Gets or sets the contact's job title.

public string JobTitle { get; set; }

Property Value

string

MSExchangeCertificate

Gets the MSExchange certificate from the directory

public byte[][] MSExchangeCertificate { get; }

Property Value

byte[][]

Manager

Gets or sets the name of the contact's manager.

public string Manager { get; set; }

Property Value

string

ManagerMailbox

Gets the manager mailbox information

public EmailAddress ManagerMailbox { get; }

Property Value

EmailAddress

MiddleName

Gets or sets the initials of the contact.

public string MiddleName { get; set; }

Property Value

string

Mileage

Gets or sets the mileage for the contact.

public string Mileage { get; set; }

Property Value

string

NickName

Gets or sets the middle name of the contact.

public string NickName { get; set; }

Property Value

string

Notes

Get the Notes from the directory

public string Notes { get; }

Property Value

string

OfficeLocation

Gets or sets the location of the contact's office.

public string OfficeLocation { get; set; }

Property Value

string

PhoneNumbers

Gets an indexed list of phone numbers for the contact. For example, to set the home phone number, use the following syntax: PhoneNumbers[PhoneNumberKey.HomePhone] = "phone number"

public PhoneNumberDictionary PhoneNumbers { get; }

Property Value

PhoneNumberDictionary

PhoneticFirstName

Gets the phonetic first name from the directory

public string PhoneticFirstName { get; }

Property Value

string

PhoneticFullName

Gets the full phonetic name from the directory

public string PhoneticFullName { get; }

Property Value

string

PhoneticLastName

Gets the phonetic last name from the directory

public string PhoneticLastName { get; }

Property Value

string

PhysicalAddresses

Gets an indexed list of physical addresses for the contact. For example, to set the business address, use the following syntax: PhysicalAddresses[PhysicalAddressKey.Business] = new PhysicalAddressEntry()

public PhysicalAddressDictionary PhysicalAddresses { get; }

Property Value

PhysicalAddressDictionary

PostalAddressIndex

Gets or sets the index of the contact's postal address. When set, PostalAddressIndex refers to an entry in the PhysicalAddresses indexed list.

public PhysicalAddressIndex? PostalAddressIndex { get; set; }

Property Value

PhysicalAddressIndex?

Profession

Gets or sets the contact's profession.

public string Profession { get; set; }

Property Value

string

SpouseName

Gets or sets the name of the contact's spouse.

public string SpouseName { get; set; }

Property Value

string

Surname

Gets or sets the surname of the contact.

public string Surname { get; set; }

Property Value

string

UserSMIMECertificate

Gets the User SMIME certificate from the directory

public byte[][] UserSMIMECertificate { get; }

Property Value

byte[][]

WeddingAnniversary

Gets or sets the date of the contact's wedding anniversary.

public DateTime? WeddingAnniversary { get; set; }

Property Value

DateTime?

Methods

Bind(ExchangeService, ItemId)

Binds to an existing contact and loads its first class properties. Calling this method results in a call to EWS.

public static Contact Bind(ExchangeService service, ItemId id)

Parameters

service ExchangeService

The service to use to bind to the contact.

id ItemId

The Id of the contact to bind to.

Returns

Contact

A Contact instance representing the contact corresponding to the specified Id.

Bind(ExchangeService, ItemId, PropertySet)

Binds to an existing contact and loads the specified set of properties. Calling this method results in a call to EWS.

public static Contact Bind(ExchangeService service, ItemId id, PropertySet propertySet)

Parameters

service ExchangeService

The service to use to bind to the contact.

id ItemId

The Id of the contact to bind to.

propertySet PropertySet

The set of properties to load.

Returns

Contact

A Contact instance representing the contact corresponding to the specified Id.

GetContactPictureAttachment()

Retrieves the file attachment that holds the contact's picture.

public FileAttachment GetContactPictureAttachment()

Returns

FileAttachment

The file attachment that holds the contact's picture.

RemoveContactPicture()

Removes the contact's picture.

public void RemoveContactPicture()

SetContactPicture(byte[])

Sets the contact's picture using the specified byte array.

public void SetContactPicture(byte[] content)

Parameters

content byte[]

The bytes making up the picture.

SetContactPicture(Stream)

Sets the contact's picture using the specified stream.

public void SetContactPicture(Stream contentStream)

Parameters

contentStream Stream

The stream containing the picture.

SetContactPicture(string)

Sets the contact's picture using the specified file.

public void SetContactPicture(string fileName)

Parameters

fileName string

The name of the file that contains the picture.