Powershell을 사용하여 Outlook 2010의 "받은 편지함"하위 폴더 (예 : "subfolder")에 액세스하려고합니다.Powershell을 사용하여 Inbox 하위 폴더를 지정하는 방법
$olFolderInbox = 6
$outlook = new-object -com outlook.application;
$ns = $outlook.GetNameSpace("MAPI");
$inbox = $ns.GetDefaultFolder($olFolderInbox)
# how do I specify a subfolder that's inside Inbox???
# I mean, "Inbox\subfolder" where "subfolder" is the name of the subfolder...
어떻게이 하위 폴더를 지정합니까?
저는 이것이 정말 간단하다는 것을 확신합니다. 그래서 나는 "잃을 것"입니다. 미리 감사드립니다!
* 나중에 내 코드 본문에서 "searchterm"을 검색하고 일치하는 항목이 있으면 텍스트 파일로 결과를 보냅니다. ... 대신받은 편지함의
$inbox.items | foreach {
if($_.body -match "searchterm") {$_.body | out-file -encoding ASCII foo.txt} # prints to file...
, 내가 전술 한 바와 같이받은 편지함의 하위 폴더에서보고 싶지
+++++++++++ : 다음 코드는받은 편지함 작동 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++
편집 :
$olFolderInbox = 6
$outlook = new-object -com outlook.application;
$ns = $outlook.GetNameSpace("MAPI");
$inbox = $ns.GetDefaultFolder($olFolderInbox)
$targetfolder = $inbox.Folders | where-object { $_.name -eq "Subfolder" }
$targetfolder.items | foreach {
if($_.body -match "keyword") {$_.body | out-file -Append -encoding ASCII foo.txt} # keyword match prints body to file...
}
OK, 나는 ...이 지금 작동 생각
글자 그대로 Powershell을 사용한 첫날이기는하지만, 내가 뭘 잘못하고 있었는지 모르겠습니다. 정말 놀랍지 않습니다.
VBScript 인 경우 다음과 같이 설정하지 마십시오. Set myNewFolder = inbox.Folders ("subfolder") – PleaseHelpTheNewGuy
전체 소스 코드 샘플을 사용하는 최종 해결책이 있습니까? – Kiquenet