PoshCode Archive  Artifact [c57bf347c4]

Artifact c57bf347c4dfddf3c893d3a2dbb2d25de2949a0c7a83acebdee3a61049511b80:

  • File Get-MailAttachment.ps1 — part of check-in [d22b83702a] at 2018-06-10 13:12:37 on branch trunk — Get an attachment from an exchange e-mail. (user: George Mauer size: 845)

# encoding: ascii
# api: powershell
# title: Get-MailAttachment.ps1
# description: Get an attachment from an exchange e-mail.
# version: 0.1
# author: George Mauer
# license: CC0
# x-poshcode-id: 2578
# x-archived: 2017-03-01T06:58:02
# x-published: 2012-03-24T14:42:00
#
# Use with – http://poshcode.org/2520 
# Requires the installation of Exchange Web Services API:
# Docs: http://msdn.microsoft.com/en-us/library/dd637749(v=exchg.80).aspx
# Download: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c3342fb3-fbcc-4127-becf-872c746840e1
#
param([Microsoft.Exchange.WebServices.Data.FileAttachment]$attachment)
"Downloading Attachment"
$attachment.Load()
"Done"
$path = "C:\temp\"+$attachment.Name
"Writing to $path"
set-content -value $mm[1].Attachments[0].Content -enc byte -path $path
"Done"
ii $path