You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 2, 2019. It is now read-only.
Hi,
I have been playing with gmail.ps these last few hours and I have been having issues with the save-attachment command. When I define a $folder = "c:/gmail/"
$gmail | Get-Mailbox -Label "Important" | Get-Message -Unread -HasAttachment -Prefetch | Save-Attachment $folder
the attachments go to the location of the ps1 script under the folder "c".
script location "c:/scripts/gmail.ps1"
location of attachments "c:/scripts/c/"
I was expecting the attachments to be located under "c:/gmail/".
Is this a bug or am I missing something?
Thanks in advance.
Johnty
The text was updated successfully, but these errors were encountered:
I was having the same issue but have identified the issue. This issue is caused by line 815 in Gmail.ps.psm1, this is part of the Save-Attachment function.
You need to change this line from "$paths = ($LiteralPath + $Path | Where { $_ })"
to "$paths = @($LiteralPath + $Path | Where { $_ })"
This forces the results to be stored as an array, without this, if the $paths variable only contains one value then it is treated as a string, then using "$destPath = $paths[$i]" as per line 818 will return single characters in position $i rather than the full path.
Line 818 originally shows as $destPath = $paths[$i], I imagine this variable is expected to contain more than one results, so you would select the results one at a time with $i and iterate through one after another.
Hi,
I have been playing with gmail.ps these last few hours and I have been having issues with the save-attachment command. When I define a $folder = "c:/gmail/"
$gmail | Get-Mailbox -Label "Important" | Get-Message -Unread -HasAttachment -Prefetch | Save-Attachment $folder
the attachments go to the location of the ps1 script under the folder "c".
script location "c:/scripts/gmail.ps1"
location of attachments "c:/scripts/c/"
I was expecting the attachments to be located under "c:/gmail/".
Is this a bug or am I missing something?
Thanks in advance.
Johnty
The text was updated successfully, but these errors were encountered: