Post to Public Folder not working 
Author Message
 Post to Public Folder not working

I am trying to post to a public folder with an attachment.  The "Test
Folder" exists and is case sensitive and I know I can access it.
When I post, my posting always goes into the "Inbox" folder.  What am I
doing wrong???

My coding is in VB6.

Thanks, Glen

Code is as follows:

Option Explicit

Public objApp As Outlook.Application

Sub Main()

  Set objApp = Outlook.Application
  If objApp Is Nothing Then
    Set objApp = New Outlook.Application
  End If

  Call Post

End Sub

Private Sub Post()
  Dim objFolder As Outlook.MAPIFolder
  Dim objNS As Outlook.NameSpace
  Dim oAttachments As Outlook.Attachments
  Dim CLAItem As Object
  Set objNS = objApp.GetNamespace("MAPI")
  Set objFolder = objNS.Folders("Public Folders"). _
  Folders("All Public Folders").Folders("Test Folder")
  Set CLAItem = objApp.CreateItem(olPostItem)
  CLAItem.Save
  Set oAttachments = CLAItem.Attachments
  oAttachments.Add "C:\Test.pdf", olByValue, 1, "Test for Glen"
  CLAItem.Post
  Set objFolder = Nothing
  Set objNS = Nothing
End Sub



Mon, 03 Feb 2003 03:00:00 GMT  
 Post to Public Folder not working
You need to use objFolder.Items.Add rather than CreateItem.

--
Sue Mosher
Author of
  "Teach Yourself Microsoft Outlook 2000 Programming in 24 Hours"
  "Microsoft Outlook 2000 E-mail and Fax Guide"

Outlook and Exchange solutions at http://www.slipstick.com


Quote:
> I am trying to post to a public folder with an attachment.  The "Test
> Folder" exists and is case sensitive and I know I can access it.
> When I post, my posting always goes into the "Inbox" folder.  What am I
> doing wrong???

> My coding is in VB6.

> Thanks, Glen

> Code is as follows:

> Option Explicit

> Public objApp As Outlook.Application

> Sub Main()

>   Set objApp = Outlook.Application
>   If objApp Is Nothing Then
>     Set objApp = New Outlook.Application
>   End If

>   Call Post

> End Sub

> Private Sub Post()
>   Dim objFolder As Outlook.MAPIFolder
>   Dim objNS As Outlook.NameSpace
>   Dim oAttachments As Outlook.Attachments
>   Dim CLAItem As Object
>   Set objNS = objApp.GetNamespace("MAPI")
>   Set objFolder = objNS.Folders("Public Folders"). _
>   Folders("All Public Folders").Folders("Test Folder")
>   Set CLAItem = objApp.CreateItem(olPostItem)
>   CLAItem.Save
>   Set oAttachments = CLAItem.Attachments
>   oAttachments.Add "C:\Test.pdf", olByValue, 1, "Test for Glen"
>   CLAItem.Post
>   Set objFolder = Nothing
>   Set objNS = Nothing
> End Sub



Tue, 04 Feb 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Could not post to the Public Folder in an Outlook98

2. Outlook Security Settings Public Folder not working

3. Document_open event does not work in public folders

4. Deleting a Public Folder Mail Item Does not work - Even with right permissions

5. Post to Public Folders with Late Binding

6. Auto-Post in Public Folders

7. Post to a specific Public Folder using CDO

8. Catch the Delete event of a Post Item in a public folder

9. Programmatically post a .ppt file to an Exchange public folder

10. Re Post Archiving Public Folders Using VBA

11. Public Folders message post automaticallly emails a distribution list

12. Post Request in a Public Folder

 

 
Powered by phpBB® Forum Software