This is my very first StackOverflow post so I will try to be undestandable as much as possible :D
I'm parsing some .pst files to get all the mails and their properties and then export them as .csv files.
The thing is I don't want the attachments as a list or string. I want to create a new column in the CSV for each of them.
Let's say this are my datas :
Sender : bla@bla.com
Receiver : blu@blu.com
Subject : How not to die
Attachments : BestCatPic.jpg BestDogPic.jpg
Then I add each attachments as new properties ($piece
is a number):
$email | Add-Member -NotePropertyName "Attachment-$piece" -NotePropertyValue "$e"
And this is working because then my datas looks like this :
Sender : bla@bla.com
Receiver : blu@blu.com
Subject : How not to die
Attachments : BestCatPic.jpg BestDogPic.jpg
Attachment-1 : BestCatPic.jpg
Attachment-2 : BestDogPic.jpg
My problem is that when I use Export-Csv
, the datas are the same as if I didn't used add-member
and the new properties like Attachment-1
does not appears in my CSV file.
Here is my Export-Csv line ($email_out
is my list of all mails):
$email_out | Export-Csv -Encoding UTF8 $pstName -NoTypeInformation
Do you guys have any idea why or what could help ?