【发布时间】:2014-07-26 08:20:29
【问题描述】:
我正在尝试编写一个脚本来断开 PST 文件与 Outlook 的连接。
我一直在尝试这样的事情:
$Outlook = new-object -com outlook.application
$Namespace = $Outlook.getNamespace("MAPI")
$PSTtoDelete = "c:\test\pst.pst"
$Namespace.RemoveStore($PSTtoDelete)
我收到以下错误:
“无法找到“RemoveStore”和参数计数“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 方法需要一个文件夹。
如果有人能给我一个关于这个的提示,将不胜感激!
谢谢!
【问题讨论】:
标签: powershell outlook pst