Re: Create Outlook Contacts

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



You need to set a bunch of named properties to make a message look like a
normal IPM.Contact item.
Look at the contacts with MFCMAPI or OutlookSpy, also see
http://www.cdolive.com/cdo10.htm

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Ethics" <Ethics@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:75B76D12-5BF6-4AE8-9156-22B9CC7354B1@xxxxxxxxxxxxxxxx
> Hi,
>
> I use program to verify the existence of application created contacts and
> found that it exists in the DefaultContactsFolder, see method below.
>
> Now I need to find out how to make it visible at the MsOutlook client.
> Can
> somebody throw me some light on this why is it not showing at the Ms
> Outlook
> Contacts ?
>
> Thank you.
>
> public void testSearchOutlookContact()
> {
> try {
> // Authenticate to NT domain via NTLM
> AuthInfo.setDefault(domain, user, password);
>
> // Start a MAPI Session
> Session session = new Session(CDOmachine);
>
> // Logon to the Exchange Server
> session.logon(null, null, new Boolean(false), new Boolean(true),
> new Integer(0), new Boolean(true),
> exchangeServer + "\n" + mailbox);
>
> // Retrieve the contacts folder
> Integer folderID = new
> Integer(CdoDefaultFolderTypes.CdoDefaultFolderContacts);
> Folder contactFolder = new
> FolderProxy(session.getDefaultFolder(folderID));
>
> // Retrieve contact items as Message objects
> Messages contacts = new MessagesProxy(contactFolder.getMessages());
>
> // now display the filtered results if any
> int count = ((Integer)contacts.getCount()).intValue();
> System.out.println("Found " + count + " contact items:");
> if( count > 0){
> for(int i=1; i<=count; i++ ){
>
> // note that most items in the Exchange Server are exposed as Message
> objects
> Message message = new MessageProxy(contacts.getItem(new Integer(i)));
>
> // retrieve the company name and business phone number
> Fields fields = new FieldsProxy(message.getFields());
> Field companyField = new FieldProxy(fields.getItem(
> new Integer(CdoPropTags.CdoPR_COMPANY_NAME),
> CdoPropSetID3)
> );
> Field phoneField = new FieldProxy(fields.getItem(
> new Integer(CdoPropTags.CdoPR_BUSINESS_TELEPHONE_NUMBER),
> CdoPropSetID3)
> );
>
> }
> }
>
> // Logoff and release all COM references
> session.logoff();
> Cleaner.releaseAll();
>
> } catch (Exception ex) {
> ex.printStackTrace();
> }
> }
>
>
> Regards,
> ET.
>


.



Relevant Pages

  • Re: Create Outlook Contacts
    ... OutlookSpy - Outlook, CDO ... > // create a Session in the CDOmachine ... > // get the Contacts folder ...
    (microsoft.public.win32.programmer.messaging)
  • Re: retrieve folder names of a Mailbox
    ... OutlookSpy - Outlook, CDO ... I want to retrieve programatically the folder names (Inbox, Outbox, ... I want to retrieve those bocz the Exchange server may be installed on a ...
    (microsoft.public.exchange.development)
  • Re: MAPI Question: Global Address List
    ... OutlookSpy - Outlook, CDO ... and MAPI Developer Tool ... > Is there any way to get at the GAL without a session? ...
    (microsoft.public.win32.programmer.messaging)
  • Re: 80040605 Error with CDO 1.21 and .NET
    ... OutlookSpy - Outlook, CDO ... Session session = new Session; ... Folder outbox = session.Outbox; ...
    (microsoft.public.win32.programmer.messaging)
  • Re: programmatically detect the status of a remote exchange server
    ... Session does not have an entry id, only address entries, distribution lists, ... OutlookSpy - Outlook, CDO ... and MAPI Developer Tool ...
    (microsoft.public.win32.programmer.messaging)