我想寫一個腳本來從Outlook斷開PST文件。如何使用Powershell從Outlook斷開PST文件?
我一直在試圖像這樣的東西:
$Outlook = new-object -com outlook.application
$Namespace = $Outlook.getNamespace("MAPI")
$PSTtoDelete = "c:\test\pst.pst"
$Namespace.RemoveStore($PSTtoDelete)
我得到以下錯誤:
"Cannot Find overload for "RemoveStore" and the argument count "1".
我也試圖與此不同的解決方案(在這裏找到http://www.mikepfeiffer.net/2013/04/how-to-test-outlook-pst-personal-folder-file-access-with-powershell/):
$namespace.GetType().InvokeMember('RemoveStore',[System.Reflection.BindingFlags]::InvokeMethod,$null,$namespace,($PSTFolder))
我看了一下technect documentations,如果我理解RemoveStore方法需要一個文件夾。
如果有人能夠給我一個暗示,這將是不勝感激!
謝謝!
感謝很多:)它的工作直! – xashcorex
如果PST與主帳戶名稱相同,$ PSTFolder是錯誤的對象。 RemoveStore不起作用。 – Alban
RemoveStore不指望名稱(字符串)。它期望Store對象的一個實例。 –