받은 편지함에서 특정 제목의 Outlook 메시지를 읽고 특정 제목과 관련된 첨부 파일을 다운로드하려고했습니다. 이 난 나는 paramater로 프로파일 암호로 $namespace.Logon
를 추가 한 경우에도 수동으로 제공 될 전망 MAPI 객체가 생성 된 후에 그러나, 나는 프로파일 암호를 묻는 메시지가되었다Powershell for Outlook 메시지 읽기
$filepath = “C:\folder”
$filter="[Subject]=Test Powershell"
Add-type -assembly "Microsoft.Office.Interop.Outlook" | out-null
$olFolders = "Microsoft.Office.Interop.Outlook.olDefaultFolders" -as [type]
$outlook = new-object -comobject outlook.application
$namespace = $outlook.GetNameSpace("MAPI")
$namespace.Logon("profilename","mypassword",$false,$false)
$folder = $namespace.getDefaultFolder($olFolders::olFolderInBox)
#$folder.items|select *
$folder.items.Restrict($filter)|
select -Expand Attachments | % {
for ($i = $_.Count; $i; $i--) {
$_.Item($i).SaveAsFile("$filepath\$($_.Item($i).FileName)")
}
}
를 사용한 파워 쉘 스크립트입니다. 암호 프롬프트없이 스크립트의 암호를 보내고 싶습니다. 그렇게하기위한 변경 사항을 지적하십시오.
[The Documentation] (https://msdn.microsoft.com/en-us/library/office/ff861594.aspx)에 따르면 Logon() 메서드의 암호 필드는 더 이상 사용되지 않으므로 작동하지 않습니다 최신 시스템 구성. 기본 프로파일을 사용한다면'Logon()'메소드를 삭제할 수 있지만,이 방법이 특정 유즈 케이스에서 작동 할 수 있도록 좀 더 읽기를 원할 것입니다. 응답에 대한 –