I'm trying to save attachments from outlook and have bumped around in the
dark to create the following code in PSv1:
$outlook = new-object -com Outlook.Application
$outlook.Session.GetDefaultFolder(6)
$attachments = $inbox.items |% {$_.attachments}
$attachments |% {$_.saveasfile("C:\TEMP")}
In the console I get the error: "Exception calling "SaveAsFile" with "1"
argument(s): "Cannot save the attachment. You don't have appropriate
permission
to perform this operation."
PowerGUI Script Editor error: "You cannot call a method on a null-valued
xpression.
At :line:4 char:30
+ $attachments |% {$_.saveasfile <<<< ("C:\TEMP\")}"
I'm confused as clearly the functions are listed in the memberclasses for
each... and I actually see the attachments from my emails in $attachments...
yet it isn't panning out. I can't find anyone else out there with examples
for this which I think many would find useful.
Have any of you done this or have any input for a solution?
Do you know if it's possible to open outlook up through powershell using
different profiles? they don't have to run at the same time, just kind of
like how outlook prompts you when you select which profile you want to use.
Was just curious.
You're awesome, Kiron! :)
And while you are at it. Can you tell me why this works if I open
powershell as User, but not as Administrator?
"OldDog" <mike...@comcast.net> wrote in message
news:95d770e2-40d9-421a...@41g2000yqf.googlegroups.com...