Solved

Adding a contact item to a public folder using CDO

Posted on 2002-07-17
3
297 Views
Last Modified: 2007-12-19
I am Trying to add a contact item to a public folder using CDO in a VB application. Problem i am having is populating the correct field. eg Business Address City in this case:

‘Ref CDO 1.21 Lib
Set objMessages = objFolder.Messages
Set objContact = objMessages.Add
objContact.Type = "IPM.Contact"
Set objFields = objContact.Fields

objFields.Add CdoPR_DISPLAY_NAME, "CH DISPLAY NAME!"
objFields.Add cdoPR_COMPANY_NAME, "My Company"
objFields.Add &H3A27001E, “London”    ‘ Business Address City
objContact.Update True, True


I want the Business Address City field to be populated, so that you can see the address on the General tab of the contact item - however the field that is populated is the City field on the All Fields tab - and doesn’t feature in the business address city field.

Any Thoughts
0
Comment
Question by:little2do
3 Comments
 

Author Comment

by:little2do
ID: 7161564
Solved the problem, just not sure how to delete the question...

Soultion is :

Set objContact = objFolder.Messages.Add

objContact.Type = "IPM.Contact"

objContact.Subject = "Subject2"

Set objContactFields = objContact.Fields

objContactFields.Add CdoPR_COMPANY_NAME, "Company Name"
objContactFields.Add CdoPR_SURNAME, "Surname"
objContactFields.Add CdoPR_MIDDLE_NAME, "Middle Name"
objContactFields.Add CdoPR_GIVEN_NAME, "Given Name"

' Write Outlook "FileAs" field
objContactFields.Add CdoContact_FileUnder, 8, objContact.Subject, CdoPropSetID3
objContactFields.Add CdoContact_FileUnderID, 3, &HFFFFFFFF, CdoPropSetID3

' Write Outlook "Business Address" fields
 strAddress = "Line 1" & Chr(13) & "Line 2" & Chr(13) & "Line 3" & Chr(13) & "Line 4" & Chr(13) & "Line 5"

objContactFields.Add CdoContact_BusinessAddressStreet, 8, "Business Street", CdoPropSetID3
objContactFields.Add CdoContact_BusinessAddressCity, 8, "Business City", CdoPropSetID3
objContactFields.Add CdoContact_BusinessAddressState, 8, "Business State", CdoPropSetID3
objContactFields.Add CdoContact_BusinessAddressPostalCode, 8, "Business Postcode", CdoPropSetID3
objContactFields.Add CdoContact_BusinessAddressCountry, 8, "Business Country", CdoPropSetID3
objContactFields.Add CdoContact_BusinessAddress, 8, strAddress, CdoPropSetID3

' Write Outlook "Mailing Address" fields with the same values as the selected address
objContactFields.Add CdoPR_STREET_ADDRESS, "Street"
objContactFields.Add CdoPR_LOCALITY, "Locality"
objContactFields.Add CdoPR_STATE_OR_PROVINCE, "State"
objContactFields.Add CdoPR_POSTAL_CODE, "Postcode"
objContactFields.Add CdoPR_BUSINESS_ADDRESS_COUNTRY, "Country"
objContactFields.Add CdoPR_POSTAL_ADDRESS, strAddress, CdoPropSetID3

' Write Outlook "Selected Address" field
objContactFields.Add CdoContact_SelectedAddress, 3, 2, CdoPropSetID3

' Add phone and fax fields
objContactFields.Add CdoPR_BUSINESS_TELEPHONE_NUMBER, "tel bus"
objContactFields.Add CdoPR_BUSINESS_FAX_NUMBER, "Bus FAX"
objContactFields.Add CdoPR_COMPANY_MAIN_PHONE_NUMBER, "Main tel"
objContactFields.Add CdoPR_MOBILE_TELEPHONE_NUMBER, "mobile"


' Add contact categories
'objContactFields.Add CdoContact_Categories, 8200, "Category", CdoPropSetID5

' Update contact item
objContact.Update True, True

0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8013854
little2do, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Refund points and save as a 0-pt PAQ.

DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 8095735
Question placed in PAQ

Computer101
E-E Admin
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Exit a vb6 apps when a calling it apps closes 15 46
VBA Shell can't Find Word document 11 92
Recommendation vb6 to vb.net or others 14 142
Problem to With line 4 57
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question