Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 314
  • Last Modified:

Adding a contact item to a public folder using CDO

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
little2do
Asked:
little2do
1 Solution
 
little2doAuthor Commented:
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
 
DanRollinsCommented:
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
 
Computer101Commented:
Question placed in PAQ

Computer101
E-E Admin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now