0
votes

Background:

I am a sysadmin for several Windows 7 machines. We have switched from an on-premises Exchange server to Office 365 Exchange Online. The computers are using Outlook 2013/2010 to connect to Exchange Online. All the clients are using full cache mode, so there is a complete OST cache file on each computer.

Because of this, there are now the following folders showing in the Folder view of Outlook: Sync Issues, then (subfolders) Conflicts, Local Failures and Server Failures.

I could not find a way to remotely administer or view these messages, so my only option appears to be manually opening each user's Outlook and viewing the folders. I have tried setting up rules to forward any messages that appear in these folders to me, but I could not get them to work on new emails that appear in these folders.

I would like to write a script that will save the email messages in these folders to a network folder where I can view them later. I would also like to have the script run on an input text file of all the computer names on the network, if possible.

I have no script writing background or knowledge. This is what I have pieced together from the web so far:

Dim OL, NmeSpace  
Set OL = CreateObject("Outlook.Application") 
Set NmeSpace = OL.GetNamespace("MAPI") 
Set Inbx = NmeSpace.GetDefaultFolder(olFolderSyncIssues) 
Set Fldr = Application.ActiveExplorer.CurrentFolder 
DirName = "C:\Emails\" 
For Each itm In Fldr.Items 
    ' Save email as a file. 
Next

Thanks in advance for any advice you can offer. I am studying scripting but I do not have the knowledge yet to write the script I want.

1
This question looks more appropriate for Server Fault.FeliceM

1 Answers

0
votes

Here is how you would go about doing that with a vbscript. Right now it only does the oSyncFolder as I left out the other two folders so you could get some practice writing it yourself.

Dim oApp 
Dim ns 
Dim oSyncFolder
Dim oConflictFolder
Dim oSrvFailuresFolder
Dim dirName
dirName = "PathToFolder\"

Set oApp = CreateObject("Outlook.Application")
Set ns = oApp.GetNamespace("MAPI")

Set oSyncFolder = ns.GetDefaultFolder(20)'olFolderSyncIssues
Set oConflictFolder = ns.GetDefaultFolder(19)'olFolderConflicts
Set oSrvFailuresFolder = ns.GetDefaultFolder(22)'olFolderServerFailures

Dim iCounter
iCounter = oSyncFolder.Items.Count

    For iCounter = oSyncFolder.Items.Count To 0 Step -1
    Dim oItem
    Set oItem = oSyncFolder.Items.Item(iCounter)
        oItem.SaveAs dirName & "email" & CStr(iCounter) & ".msg"
        'uncomment line below to remove the item after it has been relocated.
        'oItem.Delete
    Next
Set oSyncFolder = Nothing
Set oConflictFolder = Nothing
Set oSrvFailuresFolder = Nothing
Set oApp = Nothing



msgbox "Finished"