×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Help needed to list messages in an Exchange mailbox

Help needed to list messages in an Exchange mailbox

Help needed to list messages in an Exchange mailbox

(OP)
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

RE: Help needed to list messages in an Exchange mailbox

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.
https://community.spiceworks.com/topic/372093-scri...

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.

RE: Help needed to list messages in an Exchange mailbox

Exchange does offer that functionality contrary to what some say.

What you need is Exchange Web Services
https://docs.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/dd877045(v%3Dexchg.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/5991301/download-attachment-from-exchange-using-exchange-web-services

Searching and listing items https://docs.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/dd633693(v%3Dexchg.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
www.syssoft-int.com

FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?

RE: Help needed to list messages in an Exchange mailbox

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close