Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help needed to list messages in an Exchange mailbox

Status
Not open for further replies.

andyferris

IS-IT--Management
Sep 10, 2010
6
IM
Hello.

We are using Exchange 2010 SP3 and I need to list messages in some mailbox folders, and extract their message ID to a text file.

I have looked at the Search-Mailbox and Get-Message functions, but they don't seem to be able to do what I want.

Search-Mailbox seems to want to 'do something' with the message, copying or logging to another mailbox, and Get-Message applies to messages in the queue only, unless I have read this wrong.

'Get-Message | Get-Member' lists the properties I need so I am assuming I can read them somehow, but I cannot even get as far as listing the mailbox folder contents.

Can anyone help?

Thanks
 
Exchange doesn't give you that level of access on the mailbox. You will need to script using Outlook. here is a link that has sample code to list emails in a mailbox.


I hope that helps.

Regards,

Mark

No trees were harmed in posting this message, however a significant number of electrons were terribly inconvenienced.

Work SMARTER not HARDER.
 
Exchange does offer that functionality contrary to what some say.

What you need is Exchange Web Services
https://docs.microsoft.com/en-us/pr...er/exchange-server-2010/dd877045(v=exchg.140)

With it you can do pretty much everything you need as long as you have the required permissions on the mailbox.

One example of saving attachments https://stackoverflow.com/questions...ent-from-exchange-using-exchange-web-services

Searching and listing items https://docs.microsoft.com/en-us/pr...per/exchange-server-2010/dd633693(v=exchg.80)

powershell examples
https://www.powershellgallery.com/packages/EWS/1.1/Content/Get-EWSFolder.ps1
https://goodworkaround.com/2015/01/29/powershell-and-ews-managed-api/

Anything that is on the EWS object model can be done in Powershell - although sometimes a bit more work than in C#. but once a email item is retrieved then all its properties are available.

and stay out of using Outlook for this. EWS will not only give you more functionality but will also allow you to run this code on a server for example without the need to have outlook installed.

Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
I stand corrected, thanks Frederico.

I hope that helps.

Regards,

Mark

No trees were harmed in posting this message, however a significant number of electrons were terribly inconvenienced.

Work SMARTER not HARDER.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top