Post an Email to a Public Folder

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Hello,

Could someone please provide an example on how to Use VBa
code to poast a Email to a Public Group ?

Thanks
Paul
 
To add an email to any email type folder get the folder as a
MAPIFolder, get its Items collection and then use the Add method.

Dim oFolder As Outlook.MAPIFolder
Dim oItems As Outlook.Items
Dim oMail As Outlook.MailItem
Dim oOL As Outlook.Application
Dim oNS As Outlook.NameSpace

Set oOL = CreateObject("Outlook.Application")
Set oNS = oOL.GetNamespace("MAPI")
Set oFolder = oNS.Folders("Public Folders"). _
Folders("All Public Folders").Folders("MyFolder")
Set oItems = oFolder.Items
Set oMail = oItems.Add(olMailItem)

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm
 
WIll that work, Ken? My experience has been that any MailItem always saves to Drafts, regardless of whether you create it with Items.Add.

Ken Slovak - said:
To add an email to any email type folder get the folder as a
MAPIFolder, get its Items collection and then use the Add method.

Dim oFolder As Outlook.MAPIFolder
Dim oItems As Outlook.Items
Dim oMail As Outlook.MailItem
Dim oOL As Outlook.Application
Dim oNS As Outlook.NameSpace

Set oOL = CreateObject("Outlook.Application")
Set oNS = oOL.GetNamespace("MAPI")
Set oFolder = oNS.Folders("Public Folders"). _
Folders("All Public Folders").Folders("MyFolder")
Set oItems = oFolder.Items
Set oMail = oItems.Add(olMailItem)

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


Paul said:
Hello,

Could someone please provide an example on how to Use VBa
code to poast a Email to a Public Group ?

Thanks
Paul
 
Hello,

I have tried Ken's suggestion, but when I go to save or
send the message it acts as though its a regular email
not to a Public Group. They way our public groups are set
they do not have Email Address's, so any other
suggestions on how to complete this task without having
to Envolve the Email Administrator ?

Thanks
Paul
-----Original Message-----
WIll that work, Ken? My experience has been that any
MailItem always saves to Drafts, regardless of whether
you create it with Items.Add.
"Ken Slovak - [MVP - Outlook]" <[email protected]>
wrote in message
To add an email to any email type folder get the folder as a
MAPIFolder, get its Items collection and then use the Add method.

Dim oFolder As Outlook.MAPIFolder
Dim oItems As Outlook.Items
Dim oMail As Outlook.MailItem
Dim oOL As Outlook.Application
Dim oNS As Outlook.NameSpace

Set oOL = CreateObject("Outlook.Application")
Set oNS = oOL.GetNamespace("MAPI")
Set oFolder = oNS.Folders("Public Folders"). _
Folders("All Public Folders").Folders("MyFolder")
Set oItems = oFolder.Items
Set oMail = oItems.Add(olMailItem)

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


Paul said:
Hello,

Could someone please provide an example on how to Use VBa
code to poast a Email to a Public Group ?

Thanks
Paul
.
 
You're right of course, Sue. It just puts it in Drafts. Sending to the
PF's email address would be the way to go.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


WIll that work, Ken? My experience has been that any MailItem always
saves to Drafts, regardless of whether you create it with Items.Add.
 
Back
Top