2016-03-24 22 views
0
#file path 
$filepath = “c:\test\” 


#set outlook to open 
$o = New-Object -comobject outlook.application 
$n = $o.GetNamespace(“MAPI”) 


#you'll get a popup in outlook at this point where you pick the folder you want to scan 
$f = $n.pickfolder() 

#date string to search for in attachment name 
$date = Get-Date -Format yyyyMMdd 


#now loop through them and grab the attachments 
$f.Items | foreach { 
    $_.attachments | foreach { 
    Write-Host $_.filename 
    $a = $_.filename 
    If ($a.Contains($date)) { 
    $_.saveasfile((Join-Path $filepath $a)) 
     } 
    } 
} 

Yukarıdaki betikle ilgili herhangi bir kişi yardımcı olabilir, aslında ana makinede çalışır ve yazar, ancak ekleri olması gerektiği gibi sürücü klasöründe görünmüyor mu?Outlook Alt klasörü Eklenti tasarrufu - powershell COM

teşekkürler sadece senaryoyu kopyalanan ve sığınak sadece bu da tüm eklerinizi kaydetmek istiyorsanız yapmanız olacaktınız adı yyyyAAgg biçimde geçerli tarih içeren Ataşmanlarının kaydeder fark varsayarsak

cevap

0

:

#file path 
$filepath = “c:\test\” 


#set outlook to open 
$o = New-Object -comobject outlook.application 
$n = $o.GetNamespace(“MAPI”) 


#you'll get a popup in outlook at this point where you pick the folder you want to scan 
$f = $n.pickfolder() 

#now loop through them and grab the attachments 
$f.Items | foreach { 
    $_.attachments | foreach { 
    Write-Host $_.filename 
    $a = $_.filename 
    $_.saveasfile((Join-Path $filepath $a)) 
    } 
} 
+0

Teşekkürler, her şeyden sonra işe yaramaz tarihini silmedim. Aslında bir alt klasöre gönderilen e-postaların olmasını istiyorum, ancak alt klasörde yer alan her bir ek baskısı var, bunu yapmanın bir yolu var mı? – Royston

+0

@Royston bilmiyorum, bir dosyayı bir klasöre geldiğinde güvenli hale getirmenin bir yolunu bulabilirseniz, dizin için bir olay işleyicisini kaydedebilir ve bu şekilde yazdırabilirsiniz, ancak kendiniz bulmalısınız. Bu konuyla ilgili kapsam dışında. Cevabınız cevabını çözdüyse, kabul etmeyi unutmayın. – Paul

İlgili konular