OL98: NoteItem.Move Actually Copies Item

ID: Q218162


The information in this article applies to:


SYMPTOMS

You use the Move method on the NoteItem object, but the item is copied instead of moved.


RESOLUTION

As a workaround, delete the original item after you use the Move method. For example:


oNoteItem.Move oDestFolder
oNoteItem.Delete 


STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.


MORE INFORMATION

This problem does not occur with other types of items, such as contacts or mail messages.

Steps to Reproduce Problem

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 professionals 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 a Microsoft Certified Solution Provider or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Solution Providers, please see the following page on the World Wide Web:

http://www.microsoft.com/mcsp/
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/
  1. In your default Notes folder make sure you have at least one Note item. Otherwise you will receive the following error when running the code below:


  2. Array index out of bounds.
  3. Create a subfolder of your Inbox called Test. When creating the folder, make sure to specify that it contains Notes.


  4. On the Tools menu, point to Forms, and then click Design a Form. Click to select Message.


  5. Click the P.2 tab.


  6. On the Form menu, Click Control Toolbox.


  7. From the Control Toolbox, drag a Command button to your new form.


  8. On the Form menu, click View Code, enter the following Visual Basic Scripting Edition (VBScript) code, and then close the Script Editor:


  9. 
    Sub CommandButton1_Click()
    
       Set oNS = Application.GetNameSpace("MAPI")
    
       ' Set a reference to the Notes folder
       Set oFldSrc = oNS.GetDefaultFolder(12)
    
       ' Set a reference to the Test folder
       Set oFldDest = oNS.GetDefaultFolder(6).Folders("Test")
    
       ' Reference the first note in the folder
       Set oNoteItem = oFldSrc.Items(1)
    
       ' Move the note.
       oNoteItem.Move oFldDest
    
    End Sub 
  10. On the Form menu, click Run this Form.


  11. Click CommandButton1 on the P.2 tab.


The note will be copied to the Test folder, but will still exist in the default Notes folder.

Adding oNoteItem.Delete under the oNoteItem.Move oFldDest line will delete the item from the originating folder and simulate a move action.


REFERENCES

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

Q180826 OL98: Resources for Custom Forms and Programming
Q182349 OL98: Questions About Custom Forms and Outlook Solutions

Additional query words: OutSol OutSol98 98 vbscript


Keywords          : kbdta OffVBS 
Version           : WINDOWS:98
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: May 27, 1999