Contacts

The "Contacts"-list are the personal contacts stored in the mailbox of the user.

MSDN Reference Links:
Synchronizing Folders by Using the FolderSync Command:
http://msdn.microsoft.com/en-us/library/ff631545(v=exchg.80).aspx
WBXML Code Page 2 - Contacts:
http://msdn.microsoft.com/en-us/library/ee202153(v=exchg.80).aspx

Inputs / Querystring parameters:

  • serverAddress
    • The address of the Exchange Server to connect to.
    • Sample: "https://mail.contoso.com/Microsoft-Server-ActiveSync/"
  • credentials
    • The base64-encoded combination of username & password. Can be formatted either as "domain\username:password" or "email:password".
    • Sample I: "John@Contoso.com:password" =>"Sm9obkBDb250b3NvLmNvbTpwYXNzd29yZA=="
    • Sample II: "Contoso\John:password" => "Q29udG9zb1xKb2huOnBhc3N3b3Jk"
  • DeviceID
    • A unique identifier for the device. Keep this parameter consistent - Exchange keeps a list of device ids and will get confused if a device changes properties randomly.
Sample: IMEI12345678
  • DeviceType
    • Identifies the type of device, and does not have to be unique.
Sample: "API Device"

Algorithm / XML documents


Synchronizing all contacts is a three-step process:
  • Do a FolderSync to retrieve the Server Ids for all folders. Use this to identify the folder for "Default Contacts".
  • Do a FolderSync with a SyncKey of 0 to acquire a new SyncKey.
  • Do a FolderSync with the new SyncKey and the Folder Id for the "Default Contacts".

The "Type" for "Default Contacts" is "9". (Can be found in the EASProtocol.Enums.FolderSyncTypes.DefaultContacts.)
"User Created Contacts"-folder has not been implemented yet.

The XML documents used are the following

Discover Folder Ids:
<?xml version="1.0" encoding="utf-8"?>
<FolderSync xmlns="FolderHierarchy">
  <SyncKey>0</SyncKey>
</FolderSync>

Get SyncKey:
<?xml version="1.0" encoding="utf-8"?>
<Sync xmlns="AirSync">
  <Collections>
    <Collection>
      <SyncKey>0</SyncKey>
      <CollectionId>FolderId</CollectionId>
    </Collection>
  </Collections>
</Sync>

Get Contacts
<?xml version="1.0" encoding="utf-8"?>
<Sync xmlns="AirSync">
  <Collections>
    <Collection>
      <SyncKey>SyncKey</SyncKey>
      <CollectionId>FolderId</CollectionId>
    </Collection>
  </Collections>
</Sync>

The API will return something similar to this (in JSON format):
[
  {
    "Anniversary": "sample string 1",
    "AssistantName": "sample string 2",
    "AssistantPhoneNumber": "sample string 3",
    "Birthday": "sample string 4",
    "Business2PhoneNumber": "sample string 5",
    "BusinessAddressCity": "sample string 6",
    "BusinessAddressCountry": "sample string 7",
    "BusinessAddressPostalCode": "sample string 8",
    "BusinessAddressState": "sample string 9",
    "BusinessAddressStreet": "sample string 10",
    "BusinessFaxNumber": "sample string 11",
    "BusinessPhoneNumber": "sample string 12",
    "CarPhoneNumber": "sample string 13",
    "Categories": "sample string 14",
    "Category": "sample string 15",
    "Children": "sample string 16",
    "Child": "sample string 17",
    "CompanyName": "sample string 18",
    "Department": "sample string 19",
    "Email1Address": "sample string 20",
    "Email2Address": "sample string 21",
    "Email3Address": "sample string 22",
    "FileAs": "sample string 23",
    "FirstName": "sample string 24",
    "Home2PhoneNumber": "sample string 25",
    "HomeAddressCity": "sample string 26",
    "HomeAddressCountry": "sample string 27",
    "HomeAddressPostalCode": "sample string 28",
    "HomeAddressState": "sample string 29",
    "HomeAddressStreet": "sample string 30",
    "HomeFaxNumber": "sample string 31",
    "HomePhoneNumber": "sample string 32",
    "JobTitle": "sample string 33",
    "LastName": "sample string 34",
    "MiddleName": "sample string 35",
    "MobilePhoneNumber": "sample string 36",
    "OfficeLocation": "sample string 37",
    "OtherAddressCity": "sample string 38",
    "OtherAddressCountry": "sample string 39",
    "OtherAddressPostalCode": "sample string 40",
    "OtherAddressState": "sample string 41",
    "OtherAddressStreet": "sample string 42",
    "PagerNumber": "sample string 43",
    "RadioPhoneNumber": "sample string 44",
    "Spouse": "sample string 45",
    "Suffix": "sample string 46",
    "Title": "sample string 47",
    "WebPage": "sample string 48",
    "YomiCompanyName": "sample string 49",
    "YomiFirstName": "sample string 50",
    "YomiLastName": "sample string 51",
    "Picture": "sample string 52",
    "Alias": "sample string 53",
    "WeightedRank": "sample string 54"
  }
]

Last edited Aug 16, 2013 at 11:43 AM by ahell, version 2

Comments

No comments yet.