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
ExchangeServiceThe ExchangeService object to which the contact will be bound.
Properties
Alias
Gets the Alias from the directory
public string Alias { get; }
Property Value
AssistantName
Gets or sets the contact's assistant name.
public string AssistantName { get; set; }
Property Value
Birthday
Gets or sets the birthday of the contact.
public DateTime? Birthday { get; set; }
Property Value
BusinessHomePage
Gets or sets the business home page of the contact.
public string BusinessHomePage { get; set; }
Property Value
Children
Gets or sets a list of children for the contact.
public StringList Children { get; set; }
Property Value
Companies
Gets or sets a list of companies for the contact.
public StringList Companies { get; set; }
Property Value
CompanyName
Gets or sets the compnay name of the contact.
public string CompanyName { get; set; }
Property Value
CompleteName
Gets the complete name of the contact.
public CompleteName CompleteName { get; }
Property Value
ContactSource
Gets the source of the contact.
public ContactSource? ContactSource { get; }
Property Value
Department
Gets or sets the department of the contact.
public string Department { get; set; }
Property Value
DirectReports
Get the direct reports mailbox information
public EmailAddressCollection DirectReports { get; }
Property Value
DirectoryId
Gets the DirectoryID as Guid or DN string
public string DirectoryId { get; }
Property Value
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
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
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
FileAsMapping
Gets or sets a value indicating how the FileAs property should be automatically calculated.
public FileAsMapping FileAsMapping { get; set; }
Property Value
Generation
Gets or sets the generation of the contact.
public string Generation { get; set; }
Property Value
GivenName
Gets or sets the given name of the contact.
public string GivenName { get; set; }
Property Value
HasPicture
Gets a value indicating whether this contact has a picture associated with it.
public bool HasPicture { get; }
Property Value
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
Initials
Gets or sets the initials of the contact.
public string Initials { get; set; }
Property Value
JobTitle
Gets or sets the contact's job title.
public string JobTitle { get; set; }
Property Value
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
ManagerMailbox
Gets the manager mailbox information
public EmailAddress ManagerMailbox { get; }
Property Value
MiddleName
Gets or sets the initials of the contact.
public string MiddleName { get; set; }
Property Value
Mileage
Gets or sets the mileage for the contact.
public string Mileage { get; set; }
Property Value
NickName
Gets or sets the middle name of the contact.
public string NickName { get; set; }
Property Value
Notes
Get the Notes from the directory
public string Notes { get; }
Property Value
OfficeLocation
Gets or sets the location of the contact's office.
public string OfficeLocation { get; set; }
Property Value
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
PhoneticFirstName
Gets the phonetic first name from the directory
public string PhoneticFirstName { get; }
Property Value
PhoneticFullName
Gets the full phonetic name from the directory
public string PhoneticFullName { get; }
Property Value
PhoneticLastName
Gets the phonetic last name from the directory
public string PhoneticLastName { get; }
Property Value
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
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
Profession
Gets or sets the contact's profession.
public string Profession { get; set; }
Property Value
SpouseName
Gets or sets the name of the contact's spouse.
public string SpouseName { get; set; }
Property Value
Surname
Gets or sets the surname of the contact.
public string Surname { get; set; }
Property Value
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
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
ExchangeServiceThe service to use to bind to the contact.
id
ItemIdThe 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
ExchangeServiceThe service to use to bind to the contact.
id
ItemIdThe Id of the contact to bind to.
propertySet
PropertySetThe 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
StreamThe stream containing the picture.
SetContactPicture(string)
Sets the contact's picture using the specified file.
public void SetContactPicture(string fileName)
Parameters
fileName
stringThe name of the file that contains the picture.