Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Accessing a Mailbox (http://www.outlookbanter.com/outlook-vba/48740-accessing-mailbox.html)

Andy Jax May 22nd 07 01:14 AM

Accessing a Mailbox
 
There is an "Other Calendar" option named Master Schedule. It is not in the
public folder tree, it is an individual user mailbox in the system. I need to
access the items and process against the schedules.

Dim emlSecond As MailItem
Dim nsMyNameSpace As NameSpace
Dim fdrInbox As MAPIFolder
Set nsMyNameSpace = Application.GetNamespace("MAPI")
Set fdrInbox = nsMyNameSpace.GetSharedDefaultFolder("Master Schedule",
olFolderInbox)
Set emlSecond = fdrInbox.Items.Item(5)
MsgBox "Second e-mail : " & vbCrLf & vbCrLf & emlSecond.Subject & vbCrLf &
emlSecond.Body

Gives a type mismatch at "Master Schedule". How do I access the mailbox items?

Dmitry Streblechenko May 22nd 07 01:39 AM

Accessing a Mailbox
 
GetSharedDefaultFolder method takes the Recipient object (such as the one
returned by Namespace.CreateRecipient) as the first parameter.
Do you have the Outlook VBA help file installed?

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

"Andy Jax" wrote in message
...
There is an "Other Calendar" option named Master Schedule. It is not in
the
public folder tree, it is an individual user mailbox in the system. I need
to
access the items and process against the schedules.

Dim emlSecond As MailItem
Dim nsMyNameSpace As NameSpace
Dim fdrInbox As MAPIFolder
Set nsMyNameSpace = Application.GetNamespace("MAPI")
Set fdrInbox = nsMyNameSpace.GetSharedDefaultFolder("Master Schedule",
olFolderInbox)
Set emlSecond = fdrInbox.Items.Item(5)
MsgBox "Second e-mail : " & vbCrLf & vbCrLf & emlSecond.Subject & vbCrLf &
emlSecond.Body

Gives a type mismatch at "Master Schedule". How do I access the mailbox
items?




Andy Jax May 22nd 07 05:50 PM

Accessing a Mailbox
 
Thank you for the CreateRecipient. This is where my error was.

"Andy Jax" wrote:

There is an "Other Calendar" option named Master Schedule. It is not in the
public folder tree, it is an individual user mailbox in the system. I need to
access the items and process against the schedules.

Dim emlSecond As MailItem
Dim nsMyNameSpace As NameSpace
Dim fdrInbox As MAPIFolder
Set nsMyNameSpace = Application.GetNamespace("MAPI")
Set fdrInbox = nsMyNameSpace.GetSharedDefaultFolder("Master Schedule",
olFolderInbox)
Set emlSecond = fdrInbox.Items.Item(5)
MsgBox "Second e-mail : " & vbCrLf & vbCrLf & emlSecond.Subject & vbCrLf &
emlSecond.Body

Gives a type mismatch at "Master Schedule". How do I access the mailbox items?



All times are GMT +1. The time now is 08:27 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-2006 OutlookBanter.com