bulk moving items to public folder
-
Monday, January 14, 2013 8:52 PM
I have over 25000 contact items imported to a local contact folder that I want to move to a public folder while deleting what's already there. Is there a method using VBA where I can do that from/to specific folders assuming I'm in the source folder perhaps? I know this can be dangerous anyways but my network administrator doesn't want me to do anything such as deleting the existing folder in public folders which already has permission settings, etc...
ie. source folder: D&M Rolodex (under myemailaccount@myemaildomain.com) or from a pst file
target folder: D&M Rolodex (under Public Folders, All Public Folders)
All Replies
-
Monday, January 14, 2013 9:06 PM
Do you want to do that programmatically? Or is it just a one time thing? Why not just drga the items to the target folder?
Dmitry Streblechenko (MVP) http://www.dimastr.com/redemption
Redemption - what the Outlook
Object Model should have been
Version 5.4 is now available!
-
Monday, January 14, 2013 9:22 PMI would like to do it programmatically instead of drag and drop which seems to lag when attempting that way.
-
Monday, January 14, 2013 9:32 PMHave you tried to use ContactItem.Move()?
Dmitry Streblechenko (MVP) http://www.dimastr.com/redemption
Redemption - what the Outlook
Object Model should have been
Version 5.4 is now available!
-
Monday, January 14, 2013 10:02 PM
While I haven't developed anything in c# to move items yet, I wonder if it's possible to accomplish in VBA similar to how I can delete all items in folder.
Set CurFolder = Application.ActiveExplorer.CurrentFolder
Set AllItems = CurFolder.Items
NumItems = CurFolder.Items.Count' Loop through all of the items in the folder
For i = 1 To NumItems
mindex = NumItems - i + 1
Set CurItem = AllItems.Item(mindex)
CurItem.Delete
Set CurItem = Nothing
Next- Edited by jfalberg Monday, January 14, 2013 10:03 PM
-
Monday, January 14, 2013 11:17 PM
Sure, use Move instead of Delete. And it is easier to use a down loop:
For i = NumItems to 1 step -1
set CurItem = AllItems.Item(i)Dmitry Streblechenko (MVP) http://www.dimastr.com/redemption
Redemption - what the Outlook
Object Model should have been
Version 5.4 is now available!
- Proposed As Answer by Dmitry Streblechenko _MVP_MVP Wednesday, January 16, 2013 4:27 PM
- Marked As Answer by Tom_Xu_WXModerator Friday, January 18, 2013 6:41 AM
-
Tuesday, January 15, 2013 12:54 PM
If using Redemption is an option, then the entire process comes down to 2 primary methods
DestFolder.EmptyFolder
....set messages to be copied
SrcFolder.Items.MoveMultiple to DestFolder (or .CopyMultiple)That will be <significantly> faster then moving one item at a time especially for 25,000 items
Karl Timmermans - The Claxton Group
Outlook Import/Export Hints/Tips
Contact import/export/data management tools for Outlook '2000/2010 - ContactGenie.com- Proposed As Answer by Dmitry Streblechenko _MVP_MVP Wednesday, January 16, 2013 4:28 PM
-
Tuesday, January 15, 2013 1:38 PMIf using MoveMultiple, it migth make sense to move the mesages in chunks of 100 or so messages to make sure each request data stays below 32 kB.
Dmitry Streblechenko (MVP) http://www.dimastr.com/redemption
Redemption - what the Outlook
Object Model should have been
Version 5.4 is now available!
-
Tuesday, January 15, 2013 3:12 PM
It looks like it works when I set my target folder to contacts at least. The big test will come when I perform this live when required.
Dim oRoot As Outlook.Folder
Dim oStore As Outlook.Store
Dim myNamespace As Outlook.NameSpace
Set myNamespace = Application.GetNamespace("MAPI")
For Each Account In myNamespace.Accounts
myEmAdr = "Public Folders - " + Account.SmtpAddress
Next
(not sure if there was a better way to do above)
Set targetFolder = myNamespace.Folders(myEmAdr).Folders("All Public Folders").Folders("D&M Rolodex")....
CurItem.Move(targetFolder)
-
Tuesday, January 15, 2013 4:23 PM
If you have multiple accounts, you might get a wrong SMTP address. Or, if the last account is PST, you will get no address at all.
Try Namespace.CurrentUser.AddressEntry.GetExchangeUser.PrimarySmtpAddress (be prepared to handle nulls and/or errors).
Dmitry Streblechenko (MVP) http://www.dimastr.com/redemption
Redemption - what the Outlook
Object Model should have been
Version 5.4 is now available!
- Proposed As Answer by Dmitry Streblechenko _MVP_MVP Wednesday, January 16, 2013 4:27 PM
- Marked As Answer by Tom_Xu_WXModerator Friday, January 18, 2013 6:41 AM
-
Tuesday, January 15, 2013 8:11 PMThat's still good to know though it will only occur from the administrator account that I'm aware of.

