Lync Conversation History

Can the Lync Conversation history that is stored in Outlook be retrieved and saved as a .pst file using Powershell?

Hey Juli,

That’s a great question.

If you are using the default layout, then you can retrieve the Conversation History folder contents via the code below.

Note that the element specified in ‘$folder = $olNS.Folders[1].Folders’ is entirely down to how many mailboxes you may have. Interestingly, the Folders array doesn’t appear to hold the first item in the list as [0], but [1]. That might just be on my system though. In any case, if you’ve more than one account configured in the same profile, then identify the number.

For exporting to PST, I’m not so certain, don’t think there is a native ‘Save As’ method. You’ll probably need to look into how Windows mail profiles are configured and if it can be automated. Otherwise, your option would be to add a mail account manually to your profile, then use the Move method for each item in the ‘$Messages’ variable.

Remember to also use the exit method at the end of the script, otherwise the outlook.exe process will continue to run.

#requires -Version 3

$olApp = New-Object -ComObject Outlook.Application
$olNS = $olApp.GetNameSpace('MAPI')

Add-Type -AssemblyName 'Microsoft.Office.Interop.Outlook'
$folder = $olNS.Folders[1].Folders | Where-Object -Property FolderPath -EQ -Value '\\emailaddress\Conversation History'
$messages = $folder.Items