Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Imort contact from filesystem into outlook contact folder 1

Status
Not open for further replies.

harmmeijer

Programmer
Mar 1, 2001
869
0
0
CN
I want to use outlook automation to read a file from the filesystem and put this file in the outlook contacts folder.

Couldn't find any property or method of the MAPIFolder object that can do that.
Could't find any property or method of the ContactItem object that loads, reads, opens or whatevers from file (to file is possible with saveas).
Couldn't find any article on the Internet that tells me how to do that.

I wonder, is it possible?


Reason I need this is because people from the office will email their contacts as attatchments for a mailinglist programm.
 
Thanx but articles like this are not what I am looking for (seem to find only articles like these though), this explaines how to import from access (or csv excel). I have the contact allready in my filesystem, doublclicking on the thing opens the contact I only want to know how I can use automation to open the thing THAT IS IN MY FILESYSTEM (not in an access database).

The contact(s) is received in my inbox as attachment, I cannot read the contactfields from an attachment (object type is attachment not contact allthough this particular attachment IS a contact). I cannot save the attachment to an outlook folder (like contacts) so I have to save it to the filesystem.
Now I thought it would be possible to open that contact but it seems impossible.
Here is the code:

Dim objOutlook As New Outlook.Application
Dim objFolder As MAPIFolder
Dim objMessages As Object
Dim objMessage As Outlook.MailItem
Dim objAttachments As Attachments
Dim objAttachment As Attachment
Dim objContact As ContactItem

Set objFolder = objOutlook.Session.GetDefaultFolder(olFolderInbox)

Set objMessages = objFolder.Items
Do Until objMessages.Count = 0
Set objMessage = objMessages.Item(1)
Set objAttachments = objMessage.Attachments
i = 0
Do Until i = objAttachments.Count
Set objAttachment = objAttachments.Item(i + 1)
' cannot read any information of the contact here because object type is attachment
' cannot save the attachment to an outlook folder so have to save it to the filesystem
objAttachment.SaveAsFile ("c:\test.msg")
' Ok now open the test.msg and read the fields of this contact
' .... huh HOW DO I DO THAT!!!!????
 
I see that I formulated my question wrong, you did answer my question so you'll get a star.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top