簡體   English   中英

重新創建PST文件

[英]Recreating PST files

我正在將PST吸入到Enterprise Vault中,但有些失敗了。 在某些情況下,我必須通過在Outlook中打開PST文件並將其內容導出到新的PST文件來重新創建PST文件。

有可能用powershell做到這一點嗎? 我是從現有的PST(而不是從Exchnage)創建新的PST,據我所知,new-mailboxexportrequest無法正常工作

TIA

安迪

您可以使用Outlook Interop (ComObject)以編程方式與Outlook Interop (ComObject)交互並添加新的PST文件。

之后,將所有文件夾從舊的PST復制到其中。

我在每個步驟中都添加了注釋,以便您了解它的操作...

當然,檢查此過程是否缺少項目是您的工作,所以,這里是:

$NewPSTFilePath = "C:\PST\Backup.pst" ## add Your new PST file name path

$outlook = New-Object -ComObject outlook.application
$namespace  = $Outlook.GetNameSpace("MAPI")

$OLDStore = $namespace.Stores | Select -First 1 ## get your old PST Store (select the first 1 only)
$NameSpace.AddStore($NewPSTFilePath) ## Add the new PST to the Current profile
$NEWStore = $namespace.Stores | ? {$_.filepath -eq $NewPSTFilePath} ## Get the New Store

$OLDPSTFolders = $OLDStore.GetRootFolder().Folders ## Get the list of folders from the PST
foreach ($folder in $OLDPSTFolders)
{
"Copy $($folder.name)"
[void]$folder.CopyTo($NEWStore)
}

注意:

該腳本使用您的默認Outlook配置文件,以連接到$namespace.Logon("OtherProfileName")配置文件,在$namespace = $Outlook.GetNameSpace("MAPI")之后添加$namespace.Logon("OtherProfileName") $namespace = $Outlook.GetNameSpace("MAPI")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM