Microsoft KB Archive/218168

= OL97: NoteItem.Move Actually Copies Item =

Article ID: 218168

Article Last Modified on 1/24/2007

-

APPLIES TO


 * Microsoft Outlook 97 Standard Edition

-



This article was previously published under Q218168





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 that this is a problem in the Microsoft products that are 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 Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

 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:

Array index out of bounds.

 Create a subfolder of your Inbox called Test. When creating the folder, make sure to specify that it contains Notes. Open a new mail message and on the Tools menu, click Design Outlook Form. Click the P.2 tab. On the Form menu, click Control Toolbox.</li> From the Control Toolbox, drag a Command button to your new form.</li>  On the Form menu, click View Code, enter the following Visual Basic Scripting Edition (VBScript) code and then close the Script Editor: 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 </li> On the Form menu, click Design Outlook Form to switch the form to run mode.</li> Click CommandButton1 on the P.2 tab.</li></ol>

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.

<div class="references_section">