How to set mainfolder.Folders to a shared mailbox?

N

Nuno Guerra

Hi there. Happy new year to all of us.

I'm using this function (Function InitMail) that was given as an answear to
a post given in 2005.
This make's a new folder under my INBOX.
What i'm looking for, is to create a new folder under a specific shared
mailbox.

The code i'm using is:

Public Function InitMail(foldername As String) As Boolean
Dim ok As Boolean

Set out = Nothing
If out Is Nothing Then
On Error GoTo InitMail_ERR
Set out = CreateObject("Outlook.Application")
Set mapi = out.GetNamespace("MAPI")
Set mainfolder = mapi.GetDefaultFolder(olFolderInbox)
On Error Resume Next
Set folder = mainfolder.Folders(foldername)
On Error GoTo 0
If folder Is Nothing Then
Set folder = mainfolder.Folders.Add(foldername)
End If
End If
InitMail = True

Exit Function
InitMail_ERR:
InitMail = False
Exit Function
End Function

How can I control the foldername in the Outllook so that my code can create
folders under a specific mailbox?

Thanks for any help.
Nuno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top