Retrieve EntryID from CDO 1.21
On May 23, 1:28 pm, Eric Legault [MVP - Outlook]
wrote:
The DASL name for the EntryID property is DAV:id!
--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:http://www.collaborativeinnovations.ca
Blog:http://blogs.officezealot.com/legault/
" wrote:
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 ffice2telephonenumber\" ";
strSql = strSql + ",
\"urn:schemas:contacts fficetelephonenumber\" ";
strSql = strSql + ",
\"urn:schemas:contacts rganizationmainphone\" ";
strSql = strSql + ",
\"urn:schemas:contacts thercity\" ";
strSql = strSql + ",
\"urn:schemas:contacts thercountry\" ";
strSql = strSql + ",
\"urn:schemas:contacts therfax\" ";
strSql = strSql + ",
\"urn:schemas:contacts thermobile\" ";
strSql = strSql + ",
\"urn:schemas:contacts therpager\" ";
strSql = strSql + ",
\"urn:schemas:contacts therpostaladdress\" ";
strSql = strSql + ",
\"urn:schemas:contacts therpostalcode\" ";
strSql = strSql + ",
\"urn:schemas:contacts therpostofficebox\" ";
strSql = strSql + ",
\"urn:schemas:contacts therstate\" ";
strSql = strSql + ",
\"urn:schemas:contacts therstreet\" ";
strSql = strSql + ",
\"urn:schemas:contacts therTelephone\" ";
strSql = strSql + ",
\"urn:schemas:contacts ager\" ";
strSql = strSql + ",
\"urn:schemas:contacts ostalcode\" ";
strSql = strSql + ",
\"urn:schemas:contacts ostofficebox\" ";
strSql = strSql + ",
\"urn:schemas:contacts rofession\" ";
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!
Thank you so much!
|