473,378 Members | 1,688 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Outlook Redemption

157 100+
Hello!

Is there someone where who can givme a code example on a Outlook innbox import ta a table in Access using Outlook redemption ?

This is a little bit out-of-my-league programming :)
May 21 '07 #1
6 5680
MrDeej
157 100+
Please anyone.

I have to get this inbox import working so that i can start desgning the rest of the system.

Now i have surfed around on the web 2 days and tried and tried a million approaches but it just refuses to import my mails to a table..

Kindly Regards a frustrated Eirik
May 22 '07 #2
MrDeej
157 100+
Like this:
Expand|Select|Wrap|Line Numbers
  1. Dim SafeMailItem, oMailItem
  2. Set SafeMailItem = CreateObject("Redemption.SafeMailItem")
  3. Set oMailItem = Outlook.Session.GetDefaultFolder(10).Items(1)
  4. SafeMailItem.Item = oMailItem
  5. MsgBox SafeMailItem.SenderName 
Should retur me the mail sendername

But it gives me a empty msgbox
May 22 '07 #3
MrDeej
157 100+
And this code
Expand|Select|Wrap|Line Numbers
  1. dim utils, MailItem, PrSenderEmailAddress, SenderEMail
  2. set utils = CreateObject("Redemption.MAPIUtils")
  3. set MailItem = Application.Session.GetDefaultFolder(6).Items(1)  'Get the first item in the inbox, can be any other item
  4. PrSenderEmailAddress = &H0C1F001E
  5. SenderEMail = utils.HrGetOneProp(MailItem.MAPIOBJECT, PrSenderEmailAddress)
  6. MsgBox SenderEMail 
  7.  
Gives me a mark on the Session in Application.Session.GetDefaultFolder(6).Items(1) with a msg of "method or data member not found"

and when i add this as instructed on the web page
Expand|Select|Wrap|Line Numbers
  1. set Application = CreateObject("Outlook.Application")
  2. set Namespace = Application.GetNamespace("MAPI")
  3. Namespace.Logon
  4.  
It gives me the same msg but this time on the GetNameSpace in the Application.GetNamespace("MAPI")
May 22 '07 #4
MrDeej
157 100+
Forget it. I just found out that if i change "Application" to "Outlook" it works!!!
Whooa!! Now i can send mails from VBA without the stupid warning message and 5 second wait


But still not figured out how to import inbox into table
May 22 '07 #5
MrDeej
157 100+
I am so proud

Expand|Select|Wrap|Line Numbers
  1. Dim rSt As New ADODB.Recordset
  2. Dim MailImport As Object, oMailImport As Object
  3. Dim mottatt As String
  4.  
  5. For i = 1 To 200
  6.  
  7. Set oMailImport = Outlook.Session.GetDefaultFolder(olFolderInbox).Items(i)
  8. Set MailImport = New Redemption.SafeMailItem
  9.  
  10. MailImport.Item = oMailImport
  11.  
  12. mottatt = MailImport.ReceivedTime
  13.  
  14. If IsNull(DLookup("date", "tbl emails", "Date = '" & mottatt & "'")) Then
  15. rSt.Open "[tbl emails]", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
  16.         With rSt
  17.             .AddNew
  18.             ![Date] = MailImport.ReceivedTime
  19.             ![fra] = MailImport.Sendername
  20.             ![emne] = MailImport.Subject
  21.             ![Body] = MailImport.Body
  22.             .Update
  23.         End With
  24.     rSt.Close
  25.     Set rSt = Nothing
  26. End If
  27.  
  28. Next
May 22 '07 #6
ADezii
8,834 Expert 8TB
I am so proud

Expand|Select|Wrap|Line Numbers
  1. Dim rSt As New ADODB.Recordset
  2. Dim MailImport As Object, oMailImport As Object
  3. Dim mottatt As String
  4.  
  5. For i = 1 To 200
  6.  
  7. Set oMailImport = Outlook.Session.GetDefaultFolder(olFolderInbox).Items(i)
  8. Set MailImport = New Redemption.SafeMailItem
  9.  
  10. MailImport.Item = oMailImport
  11.  
  12. mottatt = MailImport.ReceivedTime
  13.  
  14. If IsNull(DLookup("date", "tbl emails", "Date = '" & mottatt & "'")) Then
  15. rSt.Open "[tbl emails]", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
  16.         With rSt
  17.             .AddNew
  18.             ![Date] = MailImport.ReceivedTime
  19.             ![fra] = MailImport.Sendername
  20.             ![emne] = MailImport.Subject
  21.             ![Body] = MailImport.Body
  22.             .Update
  23.         End With
  24.     rSt.Close
  25.     Set rSt = Nothing
  26. End If
  27.  
  28. Next
GHood for you, MrDeej!
May 22 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Anushya | last post by:
Hi All This is the error i am getting when i try to install my addin in some other machine and works fine in development machine. I checked the ..net framework version it is 1.1 in developement...
7
by: Anushya | last post by:
Hi How to get the id of a name in contact items in outlook. How to do it thru redemption in .net?? i tried the code below. but it shows the error. pls have a look at the code ...
4
by: John | last post by:
Hi Does anyone have a vb.net example of how to use redemption to send mail through outlook? Many Thanks Regards
9
by: John | last post by:
Hi Is it possible to write vb.net code around outlook 2000 dlls and then use the code on ol2002 machines to send emails and bypass ol 2002 email block? Thanks Regards
8
by: John | last post by:
Hi I am using the latest redemption. I am using the below code in vb.net to send mail in html format. The problem is that text does not get sent as html and html tags appear as they are in the...
2
by: Pieter | last post by:
Hi, I'm using a thight integration with Outlook 2003 (with an Exchange server) in my VB.NET (2005) application. Until now I'm using the Outlook Object Model, but it appears to be very slow, and...
4
by: omrivm | last post by:
Hi, I have a problem with Outlook Redemption, every time I'm trying to create a new RDOAddressBook: Redemption.RDOAddressBook AB = new RDOAddressBook(); I get: "Retrieving the COM class factory...
6
by: AMP | last post by:
I am trying to write a windows sevice that will send emails. The data is stored in a database and the service scans the database for new entries It work well as a stardard windows app, but when...
2
by: dlesandrini | last post by:
Now that I have my rant about Google Search out of the way, I can ask my question. Someone must have noticed this, but since I can't Google the Access groups about it, I'll have to just ask: ...
6
by: =?Utf-8?B?UmljaA==?= | last post by:
How to suppress the Outlook 2003 security prompts from VB2005. When I tried to look at the body of a message or any other part of an outlook mailItem -- I get these annoying security prompts. I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.