Getting availble values and functions

Firstly, Im faily new to Powershell, so apoligise for this possible simplist question.

Im trying to write a scritp to dump all my outlook emails into a file exporting specific values. What my problem is I dont know what variables are available for me to use from the item Im currently looking at.

From reading several forums and websites, Ive managed to cobble together:-
$olFolderInbox = 6
$outlook = new-object -com outlook.application;
$ns = $outlook.GetNameSpace("MAPI");
$inbox = $ns.GetDefaultFolder($olFolderInbox)
#checks 10 newest messages

$inbox.items | foreach {
    write-host $_.subject
    }

Open in new window


Which works great for exporting just the subject, but now I want to have access to senders, recipents, body and attachments if possible, but cannot figure out how to see what is available in the $_.

I thought I could use get-member, but I just get error messages back. Does anyone have any ideas how I can pull the possible variable and functions from $_ at runtime ?

Its an upgrade to a script I wrote in VBA, but want to use Powershell.

Thank you in advance.
tonelm54Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Raheman M. AbdulSenior Infrastructure Support Analyst & Systems DeveloperCommented:
$olFolderInbox = 6
$outlook = new-object -com outlook.application;
$ns = $outlook.GetNameSpace("MAPI");
$inbox = $ns.GetDefaultFolder($olFolderInbox)

$inbox.items | foreach {
    write-host $_.subject
    write-host $_.SenderName
    write-host $_.ReceivedbyName
    write-host $_.Body
    }

#-----------------------------------------------
You can get the members using:

$olFolderInbox = 6
$outlook = new-object -com outlook.application;
$ns = $outlook.GetNameSpace("MAPI");
$inbox = $ns.GetDefaultFolder($olFolderInbox)

$inbox.items.item(1) | Get-Member
0
tonelm54Author Commented:
Thanks for that, but trying the 'Get-Member' doesnt return anything:-
$olFolderInbox = 6
$outlook = new-object -com outlook.application;
$ns = $outlook.GetNameSpace("MAPI");
$inbox = $ns.GetDefaultFolder($olFolderInbox)

$inbox.items.item(1) | Get-Member

Open in new window


All I get is nothing back, no error or output:-

PS U:\Desktop> u:\Desktop\export.ps1
__________________________________________________________________________________________
0
tonelm54Author Commented:
If I let it run:-
$olFolderInbox = 6
$outlook = new-object -com outlook.application;
$ns = $outlook.GetNameSpace("MAPI");
$inbox = $ns.GetDefaultFolder($olFolderInbox)

$inbox.items | foreach {
    write-host $_.subject
	write-host $_.SenderName
    write-host $_.ReceivedbyName
    write-host $_.Body
	write-host "----------------------------------------------------------------------"
    }

Open in new window


I get all the items in my inbox, so its not empty, and is reading it fine :-S
0
Raheman M. AbdulSenior Infrastructure Support Analyst & Systems DeveloperCommented:
Try $inbox.items.item(2) | Get-Member

2 or 3


You will get the output similar to the attached file contents.
text.txt
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.