Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Post file to Outlook Public Folders

Status
Not open for further replies.

neualex

Programmer
Feb 26, 2008
53
US
Guys,

I spent almost 3 hours to come up with the code below :(

I need to upload/post an HTML file to a public folder, so we can refer to it in emails with the following outlook path... outlook://Public Folders/All Public Folders/MCG/DTS Technical Contacts/~contact_list.html

However, the code below only post a new post item with the HTML file as attachment, and we cannot refer to it using the outlook path above.

Any help is appreciated!

...Alex

postToOutlookPublicFolders()

Function postToOutlookPublicFolders()

Set objOLK = CreateObject("Outlook.Application")
Set objNS = objOLK.Application.GetNamespace("MAPI")
Set objPF = objNS.Folders("Public Folders").Folders("All Public Folders").Folders("MCG").Folders("DTS Technical Contacts")

Set postItem = objPF.Items.Add("IPM.Post")

Set myAttachments = postItem.Attachments
myAttachments.Add "C:\Temp\contact_list.html", 1, 1, "Something"

postItem.Post

'objOLK.Quit
Set objOLK = Nothing
Set objNS = Nothing
Set objPF = Nothing

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top