Re: Create Outlook Contacts
- From: Ethics <Ethics@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 22 Dec 2005 21:41:02 -0800
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
>
.
- Follow-Ups:
- Re: Create Outlook Contacts
- From: Dmitry Streblechenko
- Re: Create Outlook Contacts
- References:
- Create Outlook Contacts
- From: Ethics
- RE: Create Outlook Contacts
- From: Ethics
- Re: Create Outlook Contacts
- From: Dmitry Streblechenko
- Create Outlook Contacts
- Prev by Date: HrMailboxLogon privs...
- Next by Date: ?Delete recurrence appointment added in pst by MAPI, outlook delete it without prompt
- Previous by thread: Re: Create Outlook Contacts
- Next by thread: Re: Create Outlook Contacts
- Index(es):
Relevant Pages
|