A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

how to point MAPI at express, how to get sender email ?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 16th 06, 03:13 AM posted to microsoft.public.outlook.program_vba
Tony Epton
external usenet poster
 
Posts: 4
Default how to point MAPI at express, how to get sender email ?


already multiposted to microsoft.public.outlook (no response)

I receive many email requests to scan old computer museum manuals to
pdf.
I manually paste fields from the emails in to a Microsoft Access table
of scan requests to keep track of everything.
I haven't done this since 18th Jan 2006 and i'm attempting to automate
the process to some extent to catch up.

Here is the code I've done so far:

---------------------------------------------------------------------------------
Dim lngCount As Long
Dim lngIndex As Long
Dim dteReceived As Date
Dim rs As Recordset

DoCmd.SetWarnings False
DoCmd.OpenQuery "qdelScanRequestEmails"
DoCmd.SetWarnings True

Set rs = CurrentDb().OpenRecordset("ScanRequestEmails")
Set myOlApp = CreateObject("Outlook.Application", "localhost")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set MyFolder = myNamespace.GetDefaultFolder(olFolderInbox)

lngCount = MyFolder.Items.count
For lngIndex = lngCount To 1 Step -1
Set MyItem = MyFolder.Items(lngIndex)
dteReceived = MyItem.ReceivedTime
If DateValue(dteReceived) #1/18/2006# Then Exit For
rs.AddNew
rs![TimeReceived] = dteReceived
rs![Subject] = MyItem.Subject
rs![Body] = MyItem.Body
rs![SenderName] = MyItem.SenderName
rs![SenderEmail] = MyItem.ReplyRecipientNames
rs.Update
Next lngIndex

rs.Close
Set rs = Nothing

----------------------------
1) This finds items in my Outlook inbox, how can I point to my Outlook
Express inbox instead.
2) I am not correctly picking up the senders email (return address) -
which property of the mail item should I be using ? I've tried a
number of obvious ones -
for example - if I try

rs![SenderEmail] = MyItem.ReplyRecipients

then I get error "one or more parameter values are not valid"

Many thanks in advance

Tony Epton
Ads
  #2  
Old April 17th 06, 12:07 AM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default how to point MAPI at express, how to get sender email ?

1. Outlook Object Model only works with Outlook, not with OE. They have
nothing in common but the word "Outlook" in the name.
2. The property you need is MailItem.SenderEmailAddress; available only in
Outlook 2003.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

ace join_to (Tony Epton) wrote in message
...

already multiposted to microsoft.public.outlook (no response)

I receive many email requests to scan old computer museum manuals to
pdf.
I manually paste fields from the emails in to a Microsoft Access table
of scan requests to keep track of everything.
I haven't done this since 18th Jan 2006 and i'm attempting to automate
the process to some extent to catch up.

Here is the code I've done so far:

---------------------------------------------------------------------------------
Dim lngCount As Long
Dim lngIndex As Long
Dim dteReceived As Date
Dim rs As Recordset

DoCmd.SetWarnings False
DoCmd.OpenQuery "qdelScanRequestEmails"
DoCmd.SetWarnings True

Set rs = CurrentDb().OpenRecordset("ScanRequestEmails")
Set myOlApp = CreateObject("Outlook.Application", "localhost")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set MyFolder = myNamespace.GetDefaultFolder(olFolderInbox)

lngCount = MyFolder.Items.count
For lngIndex = lngCount To 1 Step -1
Set MyItem = MyFolder.Items(lngIndex)
dteReceived = MyItem.ReceivedTime
If DateValue(dteReceived) #1/18/2006# Then Exit For
rs.AddNew
rs![TimeReceived] = dteReceived
rs![Subject] = MyItem.Subject
rs![Body] = MyItem.Body
rs![SenderName] = MyItem.SenderName
rs![SenderEmail] = MyItem.ReplyRecipientNames
rs.Update
Next lngIndex

rs.Close
Set rs = Nothing

----------------------------
1) This finds items in my Outlook inbox, how can I point to my Outlook
Express inbox instead.
2) I am not correctly picking up the senders email (return address) -
which property of the mail item should I be using ? I've tried a
number of obvious ones -
for example - if I try

rs![SenderEmail] = MyItem.ReplyRecipients

then I get error "one or more parameter values are not valid"

Many thanks in advance

Tony Epton



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to point MAPI interface at Express, how to get email of sender Tony Epton Outlook - General Queries 0 April 15th 06 04:39 PM
Adding sender email address to contacts on receipt czb Outlook - Using Contacts 1 March 20th 06 06:00 PM
can i group emails by sender & by number of items for each sender baffled_by_tech Outlook - Using Contacts 2 March 5th 06 09:27 PM
BCC and sender email miradoro Outlook - Using Contacts 3 February 27th 06 09:06 PM
i want to see the email adress of sender in the from column Levent Outlook - General Queries 2 January 24th 06 03:53 PM


All times are GMT +1. The time now is 06:02 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.