I want to create a program that will import mail information into
Outlook 2000 or above programmatically. I dont want to export to
another format and import into Outlook. Ideally it would work with
Outlook 97 and above. I want to migrate data from an existing
non-standard mail system (custom designed) into Outlook. This custom
mail system has mail, calendar and contact items and also contains
sender (To, CC and BCC) and send/receive date/time information on each
item. I dont want to use any third party tools that also need to be
installed to run the export. I want to create an executable that I can
distribute to users at multiple locations and get them to install and
run it. The new Outlook mail files will be local not on a server.
I can do this with VB to some degree but items are created in outlook
like drafts and I cannot set any sent information (like time sent,
time received, sender, To CC or BCC etc). I want the mail and other
items to contain all the original information. The fields are there in
outlook but I cant set them via VB.
It would be nice if the code was in VB but I don't think this is
possible. The sent information fields I mentioned seem to be non
updateable as far as I know. I am thinking the solution may be to use
MAPI and some variant of C code. Please dont send any assembly code
answers as that is just getting too difficult.
Please post the ACTUAL CODE or links to all of the exact pages I need
to go to get the complete code. I would like working code so I dont
need to work out how to put it together. This part is important. If it
is too complicated and the information at the linked pages too vague I
will not be able to create a solution so wont consider the question
answered.
I need to create at least the flowing items as non-draft items.
Mail Items
Calender Items
Contact Items
If someone can help me here it would be greatly appreciated. |
Request for Question Clarification by
mathtalk-ga
on
03 May 2003 06:38 PDT
Hi, whatshisname-ga:
Can we assume you have a good mastery over the source format, which
you call a "non-standard mail system"? Writing any actual code would
necessitate drawing upon the source data (as well as being able to
write into Outlook format).
regards, mathtalk-ga
|
Clarification of Question by
whatshisname-ga
on
03 May 2003 13:59 PDT
Yes, I only need the parts of the code to write to outlook. You can
assume I already have the data. I can manage this myself (It may be a
little tricky in if not in VB but will be able to do it one way or
another so dont worry about the part)
I need to deal with the following types or mail, calendar and contact
data:
Received mail (Mail the user has received already):
From
Subject
Body
To, cc, bcc
Date/Time Sent
Date/Time Received
Sent Mail (Mail already send by the user):
To, cc, bcc
Subject
Body
Date/Time Sent
Draft Mail (mail waiting to be sent)
To, cc, bcc
Subject
Body
Last Modified (not so important if this field/attribute can't be set)
Calender Item:
[All needed fields for outlook]
Date Created (not so important if this field/attribute can't be set)
Contact Item:
[All needed fields for outlook]
Date Created (not so important if this field/attribute can't be set)
|
Request for Question Clarification by
mathtalk-ga
on
06 May 2003 09:57 PDT
Hi, whatshisname-ga:
You've said you want to target Outlook 97 "and above" which currently
includes Outlook98, Outlook 2000, and Outlook 2002. Successfully
handling all these versions will make things challenging.
[HOWTO: Automate Outlook Using Visual Basic]
http://support.microsoft.com/default.aspx?scid=kb;en-us;220595
and gives the names "type library" files for each version also. When
these *.olb files are used with the "Add Reference" feature of a VB
project, it allows you to browse the Outlook Object Model within the
development environment.
[Microsoft Outlook 2002 Developer FAQ]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnout2k2/html/odc_olfaq.asp
Microsoft describes four approaches to "automating" Outlook. One is
to create a COM-based Add-in that works within Outlook (behind a
form). Another approach is to use VBScript to make Outlook forms
interactive. A third approach is to use an external program written
in VB or C++ to instantiate an Outlook.Application object and exercise
its methods. Finally a fourth approach would associate an Outlook
folder with an HTML page and use Web-based methods to manipulate the
files there.
Please take a look and help me to focus your search for a project
development plan on one approach or the other. My impression is that
you have the third approach in mind, although the first approach might
be more attractive if the versions of Outlook you were targeting was
narrower.
regards, mathtalk
|
Clarification of Question by
whatshisname-ga
on
06 May 2003 13:37 PDT
I am interested in creating a solution in Outlook 2000 or above. It
would be nice if it worked with Outlook 97 and above but that is not
important, just a nice to have.
There are other issues much more important. As I said I have been able
to write to Outlook using VB (which does that by accessing the
Outlook.Application object model and automation) but it does not give
me the ability to do what I need and the reason for the post. The
important point is that I need to create items that look like they
have already been sent or received and contain all the sent
information. The Outlook.Application object model does not allow you
to do this from what I can see. You can't set the Date or Time Sent or
received or cant even make an item looks like it is sent. I.e. Only
let you save mail items as draft or actually send them. It doesn't
seem to allow you to work at that low level.
|
Request for Question Clarification by
mathtalk-ga
on
07 May 2003 12:44 PDT
Hi, whatshisname-ga:
Okay, one more question before I try to produce some working code for
you. Any preference between VB.Net and VB6? Any solution we can
devise in VB6 can presumably be converted to VB.Net, and the
underlying technology here is COM automation (as I'm sure you've been
using so far).
regards, mt
|
Clarification of Question by
whatshisname-ga
on
07 May 2003 13:24 PDT
Either would be fine (VB 6 probably easier for now).
Please note: I don't think you can do it in strait VB and automation
but if you can prove me wrong that would be good as that is my
preferred method of coding.
Please remember it is all about the sent and received information
fields and making mail items look as though they are in posted mode
(not draft).
|
Clarification of Question by
whatshisname-ga
on
08 May 2003 15:43 PDT
richardmcgrath-ga seems to have an answer for this question. He posted
a comment that he had an answer but it contained personal information
so google removed it.
I would like to cancel it but I don't want to do so if the mathtalk-ga
(who has locked it) can answer.
From the additional information I received. I was told it could not be
done in VB.
mathtalk-ga, are you able to give me an update on your progress? Do
you think you have an answer?
|
Request for Question Clarification by
mathtalk-ga
on
08 May 2003 19:00 PDT
I do believe I have an answer, or at a minimum some useful
information.
I think that there are two quick things I can give you to resolve a
couple of immediate issues. First is how to put the mail items into
the Inbox, rather than Drafts. Second is how to set the From field.
This is a bit tricky, intentionally so since it is a "security" issue
to prevent the Outlook Object Model from being exploited to create
"fake" emails, and it is here that one needs to step "outside" the box
(no pun intended?).
I was reluctant simply to post an answer that dealt only with these
two points, since your original question asks for more ambitious
assistance. If you wish, you can expire this question, change its
price and scope, or leave the question open at this point. I'm
interested in providing only excellent quality answers, so when I post
code, I have tested it. I'm not in a position to do this for perhaps
another 24 hours, but I'd be glad to provide the links that document
the information outlined above however you prefer to receive it.
regards, mathtalk-ga
|
Clarification of Question by
whatshisname-ga
on
08 May 2003 21:05 PDT
Sorry, thanks for trying, I know you are hoping to find an answer with
more time but I think you are heading down the wrong path. So far you
have only told me what I already know. I already know how to put mail
in the Inbox or any folder using VB automation. I also know how to set
the "SentOnBehalfOfName" attribute but that is not enough. I need to
set the actual "from" and "To" fields and also the CC, BCC, time sent,
time received, and need to have the mode set. These are read only
attributes in the Outlook object model. Also I don't believe you can
make a new MailItem look "posted". In other words it has all the date
and time send attributes. I also know that these are not available
because of security issues.
I was thinking some other VB method other than accessing the outlook
object model might be available but I though it unlikely.
What I thought was also confirmed by richardmcgrath-ga that I need to
use a C based MAPI solution.
I will expire the question. Thanks for trying.
|