Microsoft KB Archive/172740: Difference between revisions
(importing KB archive) |
m (Text replacement - """ to """) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 34: | Line 34: | ||
The sample code in this article requires a reference to the Microsoft Active Messaging 1.1 Object Library (Olemsg32.dll). If you are missing this file, please see the following article in the Microsoft Knowledge Base: | The sample code in this article requires a reference to the Microsoft Active Messaging 1.1 Object Library (Olemsg32.dll). If you are missing this file, please see the following article in the Microsoft Knowledge Base: | ||
<blockquote>[[../ | <blockquote>[[../171440|Q171440]] INFO: Where to Acquire the Collaboration Data Objects Libraries</blockquote> | ||
This article requires that you set up the appropriate folders to move a message to. The sample code assumes that messages have a subject line starting with either | This article requires that you set up the appropriate folders to move a message to. The sample code assumes that messages have a subject line starting with either "East" or "West".<br /> | ||
<br /> | <br /> | ||
The syntax of the MoveTo method is as follows: | The syntax of the MoveTo method is as follows: | ||
Line 61: | Line 61: | ||
Dim f As Integer | Dim f As Integer | ||
Screen.MousePointer = vbHourglass | Screen.MousePointer = vbHourglass | ||
Set objSession = CreateObject( | Set objSession = CreateObject("MAPI.Session") | ||
objSession.Logon ( | objSession.Logon ("YourSessionIDHere") | ||
Set objInboxFolder = objSession.Inbox | Set objInboxFolder = objSession.Inbox | ||
Line 73: | Line 73: | ||
For f = 1 To .Count | For f = 1 To .Count | ||
Select Case .Item(f).Name | Select Case .Item(f).Name | ||
Case | Case "East" | ||
strEast = .Item(f).ID | strEast = .Item(f).ID | ||
Case | Case "West" | ||
strWest = .Item(f).ID | strWest = .Item(f).ID | ||
End Select | End Select | ||
Line 89: | Line 89: | ||
Private Sub cmdMoveMail_Click() | Private Sub cmdMoveMail_Click() | ||
If Not MoveMessageToInboxSubfolder Then | If Not MoveMessageToInboxSubfolder Then | ||
MsgBox | MsgBox "A move operation failed" | ||
End If | End If | ||
End Sub | End Sub | ||
Line 121: | Line 121: | ||
'Look for a subject that we want to move to another folder | 'Look for a subject that we want to move to another folder | ||
Select Case Left(UCase(objOneMessage.Subject), 4) | Select Case Left(UCase(objOneMessage.Subject), 4) | ||
Case | Case "EAST" | ||
strMoveToFolderID = strEast | strMoveToFolderID = strEast | ||
Case | Case "WEST" | ||
strMoveToFolderID = strWest | strMoveToFolderID = strWest | ||
Case Else | Case Else | ||
strMoveToFolderID = | strMoveToFolderID = "" | ||
End Select | End Select | ||
'This If statement does the actual move | 'This If statement does the actual move | ||
If strMoveToFolderID | If strMoveToFolderID <> "" Then | ||
Set objMoveMessage = objOneMessage.MoveTo(strMoveToFolderID) | Set objMoveMessage = objOneMessage.MoveTo(strMoveToFolderID) | ||
objMoveMessage.Update | objMoveMessage.Update | ||
'Need to decrement | 'Need to decrement "i" because objInMessages.Count | ||
'has decremented by 1. You need to decrement | 'has decremented by 1. You need to decrement "i" | ||
'to keep the loops synchronized | 'to keep the loops synchronized | ||
i = i - 1 | i = i - 1 | ||
Line 166: | Line 166: | ||
== REFERENCES == | == REFERENCES == | ||
For more information, please see the | For more information, please see the "MoveTo Method" topics in the July 1997 "Microsoft Developer Network Library." This is the path to that topic: | ||
<pre class="FIXEDTEXT"> SDK Documentation | <pre class="FIXEDTEXT"> SDK Documentation | ||
Line 176: | Line 176: | ||
/MoveTo Method </pre> | /MoveTo Method </pre> | ||
For additional information about Collaboration Data Objects versus Active Messaging, please see the following article in the Microsoft Knowledge Base: | For additional information about Collaboration Data Objects versus Active Messaging, please see the following article in the Microsoft Knowledge Base: | ||
<blockquote>[[../ | <blockquote>[[../176916|Q176916]] INFO: Active Messaging and Collaboration Data Objects (CDO)</blockquote> | ||
Additional query words: move | Additional query words: move | ||
Latest revision as of 11:06, 21 July 2020
The information in this article applies to:
SUMMARYUsing the Active Messaging version 1.1 Object Library you can move a message to another folder without first copying and then deleting it. This new functionality is provided by the new MoveTo method.
MORE INFORMATIONThe sample code in this article requires a reference to the Microsoft Active Messaging 1.1 Object Library (Olemsg32.dll). If you are missing this file, please see the following article in the Microsoft Knowledge Base:
This article requires that you set up the appropriate folders to move a message to. The sample code assumes that messages have a subject line starting with either "East" or "West". Set objMovedMessage = objMessage.MoveTo(folderID [, storeID ] ) where
The FolderID is a string created when a folder is created and it never changes. If you know the FolderID, you can directly code it into your application. If you do not know the FolderID, but know the folder name and where it is located, you can find the FolderID by using the ID property of the folder object. This example assumes that you do not know the FolderID, but that you do know the name of the folder you want to move a message to. Sample Code
REFERENCESFor more information, please see the "MoveTo Method" topics in the July 1997 "Microsoft Developer Network Library." This is the path to that topic: SDK Documentation /Platform SDK /Database and Messaging Services /Active Messaging /Reference /Message Object /MoveTo Method For additional information about Collaboration Data Objects versus Active Messaging, please see the following article in the Microsoft Knowledge Base:
Additional query words: move Keywords : kbCDO110 kbVBp400 kbVBp500 |
Last Reviewed: November 5, 1999 |