Moving Items
Moving Items
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
To move items within a public store, use the Record.MoveRecord method. If you move a folder item, all items within the folder are also moved. You cannot use the Record.MoveRecord method to move items from one public store or mailbox store to another.
VBScript
' Variables. Dim Rec Dim Conn Dim NewURL Dim UrlFrom Dim UrlTo UrlFrom = "https://server/public/folder1/test.eml" UrlTo = "https://server/public/folder2/test.eml" ' Open the connection object. Set Conn = CreateObject("ADODB.Connection") Conn.Provider = "ExOLEDB.DataSource" Conn.Open UrlFrom ' Open the record object. Set Rec = CreateObject("ADODB.Record") Rec.Open URLFrom, Conn, adModeReadWrite ' Move the item. Note that if an item ' already exists at the destination URI, ' it will be overwritten by the move. NewURL = Rec.MoveRecord( , URLTo, , , adMoveOverWrite) ' Clean up. Rec.Close Conn.Close
C++
#import <msado15.dll> no_namespace #import <cdoex.dll> no_namespace // Variables. _RecordPtr Rec(__uuidof(Record)); _ConnectionPtr Conn(__uuidof(Connection)); bstr_t urlfrom = "https://server/public/folder/test.eml"; bstr_t urlto = "http:/server/public/folder2/test.eml"; Conn->Provider = "ExOLEDB.DataSource"; cout << urlfrom << endl; try { // Open the connection. Conn->Open(urlfrom, bstr_t(""), bstr_t(""),-1); } catch(_com_error e) { // Handle error or throw. throw e; } try { // Open the record. Rec->Open( variant_t(urlfrom), variant_t((IDispatch*)Conn, true), adModeReadWrite, adFailIfNotExists, adOpenSource, bstr_t(""), bstr_t("")); } catch(_com_error e) { // Handle error or throw. throw e; } try { // Move the item. Note that if an item // already exists at the destination URI, // it will be overwritten by the move. Rec->MoveRecord( bstr_t(), urlto, bstr_t(), bstr_t(), (MoveRecordOptionsEnum)adMoveOverWrite, VARIANT_FALSE); } catch(_com_error e) { // Handle error or throw. throw e; } // Clean up. Rec->Close(); Conn->Close();
Related Topics
Send us your feedback about the Microsoft Exchange Server 2003 SDK.
Build: June 2007 (2007.618.1)
© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.