Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Outlook? More like Lookout!


Message #1 by Fergal Kelly <fergal@s...> on Wed, 14 Nov 2001 19:20:14 +1100
Could it be a bum (or out of date) Outlook install on your server?  How are
you setting your app up on the server--is it a P&D wizard setup?  I seem to
remember something in the kb about P&D doing something wrong with
Outlook.olb...  I can dig that up if necessary.

HTH,

-Roy

Roy Pardee
Programmer/Analyst
SWFPAC Lockheed Martin IT
Extension 8487 
-----Original Message-----
From: Deborah A. Kopp [mailto:DKOPP@f...]
Sent: Wednesday, November 14, 2001 9:15 AM
To: professional vb
Subject: [pro_vb] RE: Outlook? More like Lookout!


Fergal,
 
I ran your code, just swaped out [Set f 
ns.GetDefaultFolder(olFolderInbox)] to get my own inbox, it worked fine!
 
I am running Server2000 +Exchange
 
Deborah
 
 
 
 
 -----Original Message-----
From: Fergal Kelly [mailto:fergal@s...]
Sent: Wednesday, November 14, 2001 12:20 AM
To: professional vb
Subject: [pro_vb] Outlook? More like Lookout!
Importance: High


Hi all.  I've run into a strange and annoying problem.  I am really stumped
here - I hope someone might suggest where I might be going wrong...  What I
am doign is really simple, as is the error itself.  I am looping through
messages in an exchange a/c using outlook 2000 object model.  When I try to
get a handle to an individual message with .GetLast I get a Type Mismatch
Error.  This problem only occurs on the machine I am running it on (Windows
2000 Server with Exchange), not the machine I developed it on....
This code is pretty much out of samples I have seen on the web and works on
my local machine...  It works on my local machine (Windows 2000 Server,
Office 2000) but does not on the target machine (The same except + Exchange
Server)


Dim o As Outlook.Application 
Dim ns As Outlook.NameSpace 
Dim f As MAPIFolder 
Dim strExtractedEmail As String 
Dim msgs As Outlook.Items 
Dim msg As MailItem 
Set ns = Application.GetNamespace("MAPI") 
Set o = CreateObject("Outlook.Application") 
Set ns = o.GetNamespace("MAPI") 
Set f = ns.Folders("foo") 


Set msgs = f.Items 
'At this stage, the msgs object is OK, I can access all properties no
problem 
Do While msgs.Count > 0 
        'This gives me a Type Mismatch Error, as if I am using the wrong
object... 
        Set msg = msgs.GetLast 
        Debug.Print msg.subject 
        msg.Delete 
Loop 


I tried Dimming msg as Variant - This works, but I don't seem to have access
to all the normal properties of the msg object, for example, I read the
.subject property when using the variant, but not the .body!
-Fergal 


  Return to Index