Link to home
Create AccountLog in
Avatar of dnrp72
dnrp72Flag for Australia

asked on

MAPI error when using export-mailbox cmdlet

I'm trying to set up a quick & dirty mail archive for one of my users in Exchange 2007. The idea is to archive off to .pst file his mail items by quarter years (Q1,Q2 etc). Using the command:

export-mailbox -id userA -pstfolderpath testpath\test.pst -enddate "01/03/2007"

I come up against this error:

Error occurred in the step: Moving messages. Failed to copy messages to the destination mailbox store with error: MAPI or an unspecified service provider. ID no: 00000000-0000-00000000, error code: -1056749164

Which I understand is a fairly standard permissions error. Problem is that I know the permissions are set correctly and can test this by removing the -enddate parameter, which results in a successful export. After investigating a bit, I worked out that the original command seems to fall over when it hits a subfolder, and so have tested this by using the -includefolders parameter. The command:

export-mailbox -id userA -pstfolderpath testpath\test.pst -includefolders '\inbox' -enddate "01/03/2007"

will fail if there are any subfolders under '\inbox'. Add the names of the subfolders:

export-mailbox -id userA -pstfolderpath testpath\test.pst -includefolders '\inbox\subfolder1' -enddate "01/03/2007"

and as long as those subfolders don't have any subfolders, I will get a successful export.

If anyone can spot something I'm doing wrong, I'm all ears because this quick and dirty solution is so far not very quick and is making me pretty dirty. All help much appreciated.
 
Avatar of peakpeak
peakpeak
Flag of Sweden image

Why not use Outlook's built-in archive function? It can do an archive every day with items older than some number of months. Neither dirty nor slow.
ASKER CERTIFIED SOLUTION
Avatar of dnrp72
dnrp72
Flag of Australia image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account