M
microdevsolutions
Hello
I need programmatically import an XML file containing a list of
contacts into an Outlook public contacts folder. NOTE: I have been
looking through the newsgroups - there doesn't seem to be a way to
import directly into a public folder - this is why a temp folder is
used below.
Should this be done by
- create a temp private contact folder
- parsing the XML file
- insert each contact into the temp private contact folder
- delete the contents of the public contacts folder
- copy the contents of the temp private folder to the public contacts
folder
- delete the temp private folder
Psuedo code as per below :-
==============================================
<create temp-private-contact-folder>
Dim ol As New Outlook.Application
Dim c As Outlook.ContactItem
<Open XML-contact-file>
<read first XML-contact-file record>
<while not eof>
' Create a new Contact item.
Set c = ol.CreateItem(olContactItem)
' Specify which Outlook form to use.
' Change "IPM.Contact" to "IPM.Contact.<formname>" if you've
' created a custom Contact form in Outlook.
c.MessageClass = "IPM.Contact"
' Create all built-in Outlook fields.
If <CompanyName> <> "" Then c.CompanyName = <CompanyName>
If <ContactName> <> "" Then c.FullName = <ContactName>
' Save the contact.
c.Save
<read next XML-contact-file record>
<loop>
<delete public-contact-folder>
<copy temp-private-contact-folder to public-contact-folder>
<delete temp-private-contact-folder>
==============================================
Cheers
Travis
I need programmatically import an XML file containing a list of
contacts into an Outlook public contacts folder. NOTE: I have been
looking through the newsgroups - there doesn't seem to be a way to
import directly into a public folder - this is why a temp folder is
used below.
Should this be done by
- create a temp private contact folder
- parsing the XML file
- insert each contact into the temp private contact folder
- delete the contents of the public contacts folder
- copy the contents of the temp private folder to the public contacts
folder
- delete the temp private folder
Psuedo code as per below :-
==============================================
<create temp-private-contact-folder>
Dim ol As New Outlook.Application
Dim c As Outlook.ContactItem
<Open XML-contact-file>
<read first XML-contact-file record>
<while not eof>
' Create a new Contact item.
Set c = ol.CreateItem(olContactItem)
' Specify which Outlook form to use.
' Change "IPM.Contact" to "IPM.Contact.<formname>" if you've
' created a custom Contact form in Outlook.
c.MessageClass = "IPM.Contact"
' Create all built-in Outlook fields.
If <CompanyName> <> "" Then c.CompanyName = <CompanyName>
If <ContactName> <> "" Then c.FullName = <ContactName>
' Save the contact.
c.Save
<read next XML-contact-file record>
<loop>
<delete public-contact-folder>
<copy temp-private-contact-folder to public-contact-folder>
<delete temp-private-contact-folder>
==============================================
Cheers
Travis