Retrieve EntryID from CDO 1.21

L

laperled

Hi guys,

i'm using C# with CDO 1.21 (Exchange dll) and ADODB for listing all
the Personal Contacts of my users and sending that into a database!

I'm using this code for that :

iPerson = new CDO.PersonClass();
iPerson.DataSource.Open(strEmailAddress2, null,
ADODB.ConnectModeEnum.adModeRead,
ADODB.RecordCreateOptionsEnum.adFailIfNotExists,
ADODB.RecordOpenOptionsEnum.adOpenSource, String.Empty, String.Empty);
iMailbox =
(CDO.IMailbox)iPerson.GetInterface("IMailbox");


Console.WriteLine(iMailbox.BaseFolder);
ADODB.Connection oCn = new ADODB.Connection();
ADODB.Recordset oRs = new ADODB.Recordset();
ADODB.Fields oFields;
oCn.Provider = "ExOLEDB.Datasource";
oCn.Open(iMailbox.Contacts, "", "", -1);
string strSql;
strSql = "";
strSql = "select ";
strSql = strSql + "\"DAV:href\",
\"urn:schemas:contacts:cn\" ";
strSql = strSql + ", \"http://
schemas.microsoft.com/mapi/id/{00062004-0000-0000-C000-000000000046}/
0x8083\" ";
strSql = strSql + ",
\"urn:schemas:contacts:businesshomepage\" ";
strSql = strSql + ",
\"urn:schemas:contacts:callbackphone\" ";
strSql = strSql + ", \"urn:schemas:contacts:co
\" ";
strSql = strSql + ",
\"urn:schemas:contacts:facsimiletelephonenumber\" ";
strSql = strSql + ",
\"urn:schemas:contacts:homeCity\" ";
strSql = strSql + ",
\"urn:schemas:contacts:homeCountry\" ";
strSql = strSql + ",
\"urn:schemas:contacts:homefax\" ";
strSql = strSql + ",
\"urn:schemas:contacts:homephone2\" ";
strSql = strSql + ",
\"urn:schemas:contacts:homePhone\" ";
strSql = strSql + ",
\"urn:schemas:contacts:homePostaladdress\" ";
strSql = strSql + ",
\"urn:schemas:contacts:homePostalCode\" ";
strSql = strSql + ",
\"urn:schemas:contacts:homepostofficebox\" ";
strSql = strSql + ",
\"urn:schemas:contacts:homeState\" ";
strSql = strSql + ",
\"urn:schemas:contacts:homeStreet\" ";
strSql = strSql + ",
\"urn:schemas:contacts:mailingcity\" ";
strSql = strSql + ",
\"urn:schemas:contacts:mailingcountry\" ";
strSql = strSql + ",
\"urn:schemas:contacts:mailingpostaladdress\" ";
strSql = strSql + ",
\"urn:schemas:contacts:mailingpostalcode\" ";
strSql = strSql + ",
\"urn:schemas:contacts:mailingpostofficebox\" ";
strSql = strSql + ",
\"urn:schemas:contacts:mailingstate\" ";
strSql = strSql + ",
\"urn:schemas:contacts:mailingstreet\" ";
strSql = strSql + ",
\"urn:schemas:contacts:mobile\" ";
strSql = strSql + ",
\"urn:schemas:contacts:blush:ffice2telephonenumber\" ";
strSql = strSql + ",
\"urn:schemas:contacts:blush:fficetelephonenumber\" ";
strSql = strSql + ",
\"urn:schemas:contacts:blush:rganizationmainphone\" ";
strSql = strSql + ",
\"urn:schemas:contacts:blush:thercity\" ";
strSql = strSql + ",
\"urn:schemas:contacts:blush:thercountry\" ";
strSql = strSql + ",
\"urn:schemas:contacts:blush:therfax\" ";
strSql = strSql + ",
\"urn:schemas:contacts:blush:thermobile\" ";
strSql = strSql + ",
\"urn:schemas:contacts:blush:therpager\" ";
strSql = strSql + ",
\"urn:schemas:contacts:blush:therpostaladdress\" ";
strSql = strSql + ",
\"urn:schemas:contacts:blush:therpostalcode\" ";
strSql = strSql + ",
\"urn:schemas:contacts:blush:therpostofficebox\" ";
strSql = strSql + ",
\"urn:schemas:contacts:blush:therstate\" ";
strSql = strSql + ",
\"urn:schemas:contacts:blush:therstreet\" ";
strSql = strSql + ",
\"urn:schemas:contacts:blush:therTelephone\" ";
strSql = strSql + ",
\"urn:schemas:contacts:pager\" ";
strSql = strSql + ",
\"urn:schemas:contacts:postalcode\" ";
strSql = strSql + ",
\"urn:schemas:contacts:postofficebox\" ";
strSql = strSql + ",
\"urn:schemas:contacts:profession\" ";
strSql = strSql + ",
\"urn:schemas:contacts:street\" ";
strSql = strSql + ",
\"urn:schemas:contacts:telephoneNumber\" ";
strSql = strSql + ",
\"urn:schemas:contacts:telephonenumber2\" ";
strSql = strSql + ",
\"urn:schemas:contacts:telexnumber\" ";
strSql = strSql + ",
\"urn:schemas:contacts:title\" ";
strSql = strSql + ",
\"urn:schemas:contacts:workaddress\" ";
strSql = strSql + " from scope ('shallow
traversal of " + "\"";
strSql = strSql + iMailbox.Contacts + "\"') ";
oRs.Open(strSql,
oCn, ADODB.CursorTypeEnum.adOpenUnspecified,
ADODB.LockTypeEnum.adLockOptimistic, 1);

This is only a part of the code, but it show you how i do that! The
problem, is that i want the Unique Identifier of that contact!

Is there a way for me to retrieve a unique identifier of the contact?
Thanks a zillion!
 
Top