OL97: SaveSentMessageFolder Property Renames Folder

Last reviewed: March 2, 1998
Article ID: Q178343
The information in this article applies to:
  • Microsoft Outlook 97

SYMPTOMS

When using the SaveSentMessageFolder property in the Outlook 97 object model, the folder where sent items are to be stored is renamed instead of being set as the folder for sent items.

CAUSE

You did not use the Set command to set an object variable equal to a particular folder.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/support/supportnet/refguide/default.asp

You must use a Set statement to have this property function as expected. If you do not use the Set statement, the property simply renames the default "sent items" folder. This is because without the Set statement, the data type on the left side of the assignment statement defaults to text and therefore the value on the right side of the assignment must also be text. The default text value for a folder object is the folder's name.

The following Microsoft Visual Basic Scripting Edition (VBScript) code example illustrates the correct use of this property. It assumes that a CommandButton has been added to a message form and that you have a top- level MAPI folder named "Mailbox - John Smith," which has a subfolder named "FolderName."

   Sub CommandButton1_Click()

      ' 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("Mailbox - John Smith")
      Set Myfolder = MyMailbox.Folders("FolderName")

      ' Correctly sets the folder where the "sent item" will be stored.
      Set Item.SaveSentMessageFolder = MyFolder

      ' Sends the current mail item.
      Item.Send

   End Sub

REFERENCES

For more information about creating solutions with Microsoft Outlook 97, please see the following articles in the Microsoft Knowledge Base:

   Article-ID: Q166368
   Title     : OL97: How to Get Help Programming with Outlook

   Article-ID: Q170783
   Title     : OL97: Q&A: Questions about Customizing or
               Programming Outlook


Additional query words: OutSol OutSol97
Keywords : kbcode kbprg OffVBA OffVBS
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbprb
Solution Type : Info_Provided


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 2, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.