Mapping Custom Fields for a Contact Folder

G

Guest

I am trying to import a Contact file from Excel into a
Contact folder in Outlook. The field names that are used
in first row of the excel file for the contacts don't
match the contact field names that are available in the
Import Wizard Custom Field Mapping area.

I built and published custom form with the matching field
names and have tried to import using this form.

What happens when I import the contacts is that I continue
to only have access to the standard Contacts forms and
when I choose the custom form that I created, It comes up
very beautifully....but empty of data.

I have tried this in Private folders and public folders.

I sat through an hour long recorded webinar on Outlook
hoping for insight and have read these posts looking for
more information.

Help!
 
B

Betty

Hi Sue,

I went to your website and "captured" the VBS Script. I
have imported the information into fields where I
have "Parked" it so I can import this information into my
User Defined Fields.

Now, I know this may seem like a no-brainer but how do I
use the script?

I have gone into it the generic script and placed the
field names from the "parked" form into the areas that I
guessed are designated for that and have also inserted the
field names from my Custom form into where I imagine they
belong. I am going to insert this edited VBS Script here
if space allows.
I have tried to run the script three different ways:
From the form that I parked the info in
From the Custom form that I created
As a Macro created in Outlook outside of any forms
whatsoever.

I've probably done something silly like reverse the field
names or something but I'm at my wit's end and this is the
last thing standing between me and completeing a project
that I should have had completed a while back.

Can you please help me?

Here is the edited code:
Sub ConvertFields()
Dim objApp As Application
Dim objNS As NameSpace
Dim objFolder As MAPIFolder
Dim objItems As Items
Dim objItem As Object

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.PickFolder
If Not objFolder Is Nothing Then
Set objItems = objFolder.Items
For Each objItem In objItems
' make sure you have a Contact item
If objItem.Class = olContact Then
' convert to your published custom form
objItem.MessageClass = "IPM.Contact.Custom"
' copy data to your custom fields
objItem.UserProperties("Rep") = objItem.Manager 's
Name
objItem.UserProperties("Account") = objItem.Account
objItem.UserProperties("Mailing Address") =
objItem.BusinessStreet
objItem.UserProperties("Ship To") =
objItem.OtherStreet
objItem.UserProperties("City") =
objItem.BusinessCity
objItem.UserProperties("Zip") =
objItem.BusinessPostalCode
objItem.UserProperties("Ship To City") =
objItem.OtherCity
objItem.UserProperties("Ship To Zip") =
objItem.OtherPostalCode
objItem.UserProperties("County") =
objItem.OfficeLocation
objItem.UserProperties("Principle") = objItem.Name
objItem.UserProperties("Principle Title") =
objItem.JobTitle
objItem.UserProperties("Second Contact") =
objItem.Assistant 's Name
objItem.UserProperties("Third Contact") =
objItem.User1
objItem.UserProperties("Principle Phone") =
objItem.BusinessPhone
objItem.UserProperties("Principle Cell") =
objItem.MobilePhone
objItem.UserProperties("Principle Pager") =
objItem.Pager
objItem.UserProperties("Principle Home Phone") =
objItem.HomePhone
objItem.UserProperties("Third Contact Cell") =
objItem.OtherPhone
objItem.UserProperties("Principle Fax") =
objItem.BusinessFax
objItem.UserProperties("Second Contact Phone") =
objItem.BusinessFax
objItem.UserProperties("Second Contact Cell") =
objItem.CarPhone
objItem.UserProperties("Second Contact Home") =
objItem.HomePhoneFax
objItem.Manager 's Name = ""
objItem.Account = ""
objItem.Mailing Address = ""
objItem.ShipTo = ""
objItem.City = ""
objItem.Zip = ""
objItem.ShipTo City = ""
objItem.ShipTo Zip = ""
objItem.County = ""
objItem.Principle = ""
objItem.Principle Title = ""
objItem.Second Contact = ""
objItem.Third Contact = ""
objItem.Principle Phone = ""
objItem.Principle Cell = ""
objItem.Principle Pager = ""
objItem.Principle HomePhone = ""
objItem.Third ContactCell = ""
objItem.Principle Fax = ""
objItem.Second ContactPhone = ""
objItem.Second ContactHome = ""
objItem.Save
End If
Next
End If

Set objItems = Nothing
Set objItem = Nothing
Set objFolder = Nothing
Set objNS = Nothing
Set objApp = Nothing
End Sub

Private Sub Application_ItemSend(ByVal Item As Object,
Cancel As Boolean)

End Sub
 
S

Sue Mosher [MVP-Outlook]

In each statement, the target field needs to be on the left side of the
statement, the source data on the right. So statements like this copy the
data from the Manager field into the Rep field:

objItem.UserProperties("Rep") = objItem.Manager

What happens when you try to step through the code in VBA?
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
B

Betty

Awesome! Thanks for the reply! I am now trying to apply
this new concept. As I understand it, the code I am
trying to edit has two purposes: 1 to actually pull the
info from the excel spreadsheet 2 to pull the info from
Outlook fields into my user defined field names.
Is that correct? If so, which portion of the code is used
for pulling the info from Outlook field names into user
defined fields? (I have already "parked" the data in
Outlook fields by Custom mapping and now just need to pull
it from there into my fields. Will let you know how this
works out today.

Thanks again!
 
B

Betty

I get this response "Object doesn't support this property
or method" in a pop up window and the script opens up. I
am looking at the Field names where i "parked' the data
and it doesn't seem to like field names that have spaces
and or apostrophes for instance my data for Rep
is "parked" in the Outlook field named: "Manager's Name"
Outlook's VPS doesn't seem to like that.
 
S

Sue Mosher [MVP-Outlook]

The code statement in my last post is an example of pulling information from
a built-in Outlook field into a custom property.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
S

Sue Mosher [MVP-Outlook]

Which statement triggers that message? In general, yes, you should stay away
from using apostrophes in property names, because it can be difficult to
distinguish an apostrophe from a quotation mark limiting a string.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top