Re: Create Outlook Contacts



Hi Dmitry,

I identified the possible set methods to set named properties in the context
below. Please see the ????? lines which I was trying but failed because I am
not sure what parameters to pass in.

Please advise me in the context below, I mean what should be filled in for
????? or other area that I missed out.

Thank you.

public void testCreateOutlookContact()
{
String CdoPropSetID3 = "0420060000000000C000000000000046";
try {
// authenticate to Windows
com.linar.jintegra.AuthInfo.setDefault(domain, user, password);

// create a Session in the CDOmachine
Session session = new Session(CDOmachine);

// logon to the Exchange Server
session.logon(null, null, new Boolean(false), new Boolean(true),
new Boolean(false), new Boolean(false),
exchangeServer + "\n" + mailbox);


// get the Contacts folder
Integer folderType = new
Integer(CdoDefaultFolderTypes.CdoDefaultFolderContacts);
Folder contactFolder = new
FolderProxy(session.getDefaultFolder(folderType));

// get the contents of Contacts as a collection of Messages
Messages contactsList = new MessagesProxy(contactFolder.getMessages());

// add a new entry/activity to the collection
MessageProxy message = new MessageProxy(contactsList.add(null, null,
null, null));

// cast Message object as Contact object
Contact contact = new Contact(message);

//Set to display at Ms Outlook Contacts
contact.setPropertyByName(?????, ?????);
contact.setFolderID(?????);

// set the personal details of the Contact item
contact.setFirstName("John");
contact.setMiddleName("M.");
contact.setLastName("Doe");

// set contact numbers
contact.setBusinessPhoneNumber("(604) 252 2525");
contact.setHomePhoneNumber("(604) 599 9696");

// set e-mail addresses
contact.setEmailAddress("frank@xxxxxxxxxxxxxxxxx");

// set work-related details
contact.setCompanyName("Intrinsyc Software International, Inc.");
contact.setDepartmentName("R&D");
contact.setJobTitle("Software Engineer");
contact.setManagersName("Jane Smith");
contact.setOfficeLocation("Building A 10th Floor");

// set business address
contact.setBusinessAddressStreet("700 West Pender St.");
contact.setBusinessAddressCity("Vancouver");
contact.setBusinessAddressState("BC");
contact.setBusinessAddressPostalCode("V5S 3Y8");
contact.setBusinessAddressCountry("Canada");

// set other fields
contact.setFileAs("Doe, John");
contact.setWebPage("www.net-linx.com");
contact.setIMAddress("frank@xxxxxxxxxxxxxxxxx");
contact.setComment("Contact from Intrinsyc Software, forward all tech
support " +
"questions to this contact");
contact.setCategoriesEx(new String[]{"Software", "Client", "External"});
contact.setUserField1("this text goes to user field 1");
contact.setUserField2("this text goes to user field 2");



// save changes to the Contact item
contact.save();



// logoff from the session
session.logoff();
} catch (Exception ex) {
ex.printStackTrace();
}finally{
// release all COM references
// Cleaner.releaseAll();
}

}


Merry Christmas & Happy New Year.

ET.


"Dmitry Streblechenko" wrote:

> 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
>

.



Relevant Pages

  • Re: Repeated requests for network password
    ... It probably is an ISP thing - if you have your outlook set to check ... automatically it opens up a pop session but doens't close it, ... I know there is some sort of ISP side solution because if you google ... directs to a mail server that will not ...
    (microsoft.public.outlook)
  • Re: Move Item Command
    ... Outlook was just given as an example there. ... Windows 2000 Group Policy Registry Table: ... Move To or Copy To to the context menu. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: package session vars/ logins
    ... Say, for example, if I had a table of usernames, passwords, and ... Once the session ends their access to data ends too. ... what are some other realistic uses of package vars? ... CREATE CONTEXT in the docs.) ...
    (comp.databases.oracle.server)
  • Re: Context Menu in Outlook 2007 Preview Pane
    ... A context menu event for right-clicking in the preview pane is one that is sorely lacking, along with the Word item body context menu. ... Author of Microsoft Outlook 2007 Programming: ... you're doing all other operations and hWnds related to the WordMail window ...
    (microsoft.public.office.developer.com.add_ins)
  • Re: What are "User-defined non-transmittable MAPI properties"
    ... We use 3 custom named MAPI properties and 3 mail X-headers. ... Outbox and the user restarted Outlook. ... non-transmittable properties sounded interesting. ... we have an Outlook Addin that uses named properties e.g. ...
    (microsoft.public.win32.programmer.messaging)