![]() |
|
Problem with : SaveSentMessageFolder
Hello,
I'm using outlook 2002 with Exchange server and I'm trying to change my code using vba the default folder where the sent item are saved to a folder which is on a public folder. My code works great when the folder is on my mailbox but when the folder is located on the network I get a message from outlook saying : "The Operation failed". Does anyone know why and how I can make it work ? Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) ' Set the NameSpace object. Set olns = Item.Application.GetNamespace("MAPI") ' MyFolder is a variant variable whose subtype is "object" since a Set statement is used. Set MyMailbox = olns.Folders("Public Folders") Set MyFolder1 = MyMailbox.Folders("All Public Folders") Set MyFolder2 = MyFolder1.Folders("Important") Set MyFolder3 = MyFolder2.Folders("Document") ' Correctly sets the folder where the "sent item" will be stored. Set Item.SaveSentMessageFolder = MyFolder Item.SaveSentMessageFolder = MyFolder End Sub |
Problem with : SaveSentMessageFolder
Just checking: do you have Author permissions on that Public Folder and is it
a Mail or Post Items folder? -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "Nader" wrote: Hello, I'm using outlook 2002 with Exchange server and I'm trying to change my code using vba the default folder where the sent item are saved to a folder which is on a public folder. My code works great when the folder is on my mailbox but when the folder is located on the network I get a message from outlook saying : "The Operation failed". Does anyone know why and how I can make it work ? Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) ' Set the NameSpace object. Set olns = Item.Application.GetNamespace("MAPI") ' MyFolder is a variant variable whose subtype is "object" since a Set statement is used. Set MyMailbox = olns.Folders("Public Folders") Set MyFolder1 = MyMailbox.Folders("All Public Folders") Set MyFolder2 = MyFolder1.Folders("Important") Set MyFolder3 = MyFolder2.Folders("Document") ' Correctly sets the folder where the "sent item" will be stored. Set Item.SaveSentMessageFolder = MyFolder Item.SaveSentMessageFolder = MyFolder End Sub |
Problem with : SaveSentMessageFolder
The SaveSentMessageFolder property supports only folders in your mailbox. If you want to put an item in a public folder, either Bcc the folder's email address and set DeleteAfterSubmit = True or subscribe to the ItemAdd event on the Sent Items folder's Items collection, rather than using ItemSend.
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Nader" wrote in message ... Hello, I'm using outlook 2002 with Exchange server and I'm trying to change my code using vba the default folder where the sent item are saved to a folder which is on a public folder. My code works great when the folder is on my mailbox but when the folder is located on the network I get a message from outlook saying : "The Operation failed". Does anyone know why and how I can make it work ? Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) ' Set the NameSpace object. Set olns = Item.Application.GetNamespace("MAPI") ' MyFolder is a variant variable whose subtype is "object" since a Set statement is used. Set MyMailbox = olns.Folders("Public Folders") Set MyFolder1 = MyMailbox.Folders("All Public Folders") Set MyFolder2 = MyFolder1.Folders("Important") Set MyFolder3 = MyFolder2.Folders("Document") ' Correctly sets the folder where the "sent item" will be stored. Set Item.SaveSentMessageFolder = MyFolder Item.SaveSentMessageFolder = MyFolder End Sub |
Problem with : SaveSentMessageFolder
Hello Sue,
I took this code from your website : Dim WithEvents colSentItems As Items Private Sub Application_Startup() Dim NS As Outlook.NameSpace Set NS = Application.GetNamespace("MAPI") Set colSentItems = NS.GetDefaultFolder(olFolderSentMail).Items Set NS = Nothing End Sub Private Sub colSentItems_ItemAdd(ByVal Item As Object) If Item.Class = olMail Then MsgBox "Hello Nader" Item.Save End If End Sub and tried it on outlook 2002 but nothing happens. What could be wrong ? thanks in advance. "Sue Mosher [MVP-Outlook]" a écrit dans le message de news: ... The SaveSentMessageFolder property supports only folders in your mailbox. If you want to put an item in a public folder, either Bcc the folder's email address and set DeleteAfterSubmit = True or subscribe to the ItemAdd event on the Sent Items folder's Items collection, rather than using ItemSend. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Nader" wrote in message ... Hello, I'm using outlook 2002 with Exchange server and I'm trying to change my code using vba the default folder where the sent item are saved to a folder which is on a public folder. My code works great when the folder is on my mailbox but when the folder is located on the network I get a message from outlook saying : "The Operation failed". Does anyone know why and how I can make it work ? Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) ' Set the NameSpace object. Set olns = Item.Application.GetNamespace("MAPI") ' MyFolder is a variant variable whose subtype is "object" since a Set statement is used. Set MyMailbox = olns.Folders("Public Folders") Set MyFolder1 = MyMailbox.Folders("All Public Folders") Set MyFolder2 = MyFolder1.Folders("Important") Set MyFolder3 = MyFolder2.Folders("Document") ' Correctly sets the folder where the "sent item" will be stored. Set Item.SaveSentMessageFolder = MyFolder Item.SaveSentMessageFolder = MyFolder End Sub |
Problem with : SaveSentMessageFolder
Did you put that code in the ThisOutlookSession module? Does other VBA code run?
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Nader" wrote in message ... Hello Sue, I took this code from your website : Dim WithEvents colSentItems As Items Private Sub Application_Startup() Dim NS As Outlook.NameSpace Set NS = Application.GetNamespace("MAPI") Set colSentItems = NS.GetDefaultFolder(olFolderSentMail).Items Set NS = Nothing End Sub Private Sub colSentItems_ItemAdd(ByVal Item As Object) If Item.Class = olMail Then MsgBox "Hello Nader" Item.Save End If End Sub and tried it on outlook 2002 but nothing happens. What could be wrong ? |
Problem with : SaveSentMessageFolder
Yes, I did and I put a msgbox inside the Application_Startup() to see if
this sub is executed when I open outlook and it does. But the rest of the code is not executed (i've put breakpoint in different places) Thanks again. "Sue Mosher [MVP-Outlook]" a écrit dans le message de news: ... Did you put that code in the ThisOutlookSession module? Does other VBA code run? -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Nader" wrote in message ... Hello Sue, I took this code from your website : Dim WithEvents colSentItems As Items Private Sub Application_Startup() Dim NS As Outlook.NameSpace Set NS = Application.GetNamespace("MAPI") Set colSentItems = NS.GetDefaultFolder(olFolderSentMail).Items Set NS = Nothing End Sub Private Sub colSentItems_ItemAdd(ByVal Item As Object) If Item.Class = olMail Then MsgBox "Hello Nader" Item.Save End If End Sub and tried it on outlook 2002 but nothing happens. What could be wrong ? |
Problem with : SaveSentMessageFolder
I can't explain why the ItemAdd event wouldn't fire. It might be worth setting up a similar event handler for your Inbox to see if it works.
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Nader" wrote in message ... Yes, I did and I put a msgbox inside the Application_Startup() to see if this sub is executed when I open outlook and it does. But the rest of the code is not executed (i've put breakpoint in different places) Thanks again. "Sue Mosher [MVP-Outlook]" a écrit dans le message de news: ... Did you put that code in the ThisOutlookSession module? Does other VBA code run? "Nader" wrote in message ... Hello Sue, I took this code from your website : Dim WithEvents colSentItems As Items Private Sub Application_Startup() Dim NS As Outlook.NameSpace Set NS = Application.GetNamespace("MAPI") Set colSentItems = NS.GetDefaultFolder(olFolderSentMail).Items Set NS = Nothing End Sub Private Sub colSentItems_ItemAdd(ByVal Item As Object) If Item.Class = olMail Then MsgBox "Hello Nader" Item.Save End If End Sub and tried it on outlook 2002 but nothing happens. What could be wrong ? |
Problem with : SaveSentMessageFolder
i did and it dosen't work as well. I don't understand why ?
"Sue Mosher [MVP-Outlook]" a écrit dans le message de news: ... I can't explain why the ItemAdd event wouldn't fire. It might be worth setting up a similar event handler for your Inbox to see if it works. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Nader" wrote in message ... Yes, I did and I put a msgbox inside the Application_Startup() to see if this sub is executed when I open outlook and it does. But the rest of the code is not executed (i've put breakpoint in different places) Thanks again. "Sue Mosher [MVP-Outlook]" a écrit dans le message de news: ... Did you put that code in the ThisOutlookSession module? Does other VBA code run? "Nader" wrote in message ... Hello Sue, I took this code from your website : Dim WithEvents colSentItems As Items Private Sub Application_Startup() Dim NS As Outlook.NameSpace Set NS = Application.GetNamespace("MAPI") Set colSentItems = NS.GetDefaultFolder(olFolderSentMail).Items Set NS = Nothing End Sub Private Sub colSentItems_ItemAdd(ByVal Item As Object) If Item.Class = olMail Then MsgBox "Hello Nader" Item.Save End If End Sub and tried it on outlook 2002 but nothing happens. What could be wrong ? |
Problem with : SaveSentMessageFolder
Sue,
I've tried the code on a standalone pc without exchange server and it works great... I'm totally confused! thanks again for ur precious help. "Nader" a écrit dans le message de news: ... i did and it dosen't work as well. I don't understand why ? "Sue Mosher [MVP-Outlook]" a écrit dans le message de news: ... I can't explain why the ItemAdd event wouldn't fire. It might be worth setting up a similar event handler for your Inbox to see if it works. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Nader" wrote in message ... Yes, I did and I put a msgbox inside the Application_Startup() to see if this sub is executed when I open outlook and it does. But the rest of the code is not executed (i've put breakpoint in different places) Thanks again. "Sue Mosher [MVP-Outlook]" a écrit dans le message de news: ... Did you put that code in the ThisOutlookSession module? Does other VBA code run? "Nader" wrote in message ... Hello Sue, I took this code from your website : Dim WithEvents colSentItems As Items Private Sub Application_Startup() Dim NS As Outlook.NameSpace Set NS = Application.GetNamespace("MAPI") Set colSentItems = NS.GetDefaultFolder(olFolderSentMail).Items Set NS = Nothing End Sub Private Sub colSentItems_ItemAdd(ByVal Item As Object) If Item.Class = olMail Then MsgBox "Hello Nader" Item.Save End If End Sub and tried it on outlook 2002 but nothing happens. What could be wrong ? |
Problem with : SaveSentMessageFolder
Maybe this is part of the issue: ItemAdd and ItemChange will not fire if more than 16 items arrive or change at one time. (This is a well documented limitation of these events.)
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Nader" wrote in message ... Sue, I've tried the code on a standalone pc without exchange server and it works great... I'm totally confused! thanks again for ur precious help. "Nader" a écrit dans le message de news: ... i did and it dosen't work as well. I don't understand why ? "Sue Mosher [MVP-Outlook]" a écrit dans le message de news: ... I can't explain why the ItemAdd event wouldn't fire. It might be worth setting up a similar event handler for your Inbox to see if it works. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Nader" wrote in message ... Yes, I did and I put a msgbox inside the Application_Startup() to see if this sub is executed when I open outlook and it does. But the rest of the code is not executed (i've put breakpoint in different places) Thanks again. "Sue Mosher [MVP-Outlook]" a écrit dans le message de news: ... Did you put that code in the ThisOutlookSession module? Does other VBA code run? "Nader" wrote in message ... Hello Sue, I took this code from your website : Dim WithEvents colSentItems As Items Private Sub Application_Startup() Dim NS As Outlook.NameSpace Set NS = Application.GetNamespace("MAPI") Set colSentItems = NS.GetDefaultFolder(olFolderSentMail).Items Set NS = Nothing End Sub Private Sub colSentItems_ItemAdd(ByVal Item As Object) If Item.Class = olMail Then MsgBox "Hello Nader" Item.Save End If End Sub and tried it on outlook 2002 but nothing happens. What could be wrong ? |
All times are GMT +1. The time now is 12:58 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