0

I'm using Powershell manage my emails in Outlook :

# Connect
$Outlook = New-Object -ComObject Outlook.Application
# Select the "TDD" subfolder from my mailbox
$EmailsInFolder = $Outlook.Session.Folders.Item(5).Folders.Item("Inbox").Folders.Item("TDD").Items
$EmailsInFolder.count

This doesn't give me access to all of my mail, only some of the most recent items.

When I view the emails in Outlook I see the text "There are more items in this folder on the server - Click here to view more on Microsoft Exchange". Clicking this shows the complete set of mails.

How do I tell my Powershell script to get the items from the server?

1

You can't do it the way you're trying to do. You have Exchange Cached Mode enabled and Outlook Object Model works with cached items only. In order to be able to get all items you have to either disable Cached Mode for your account or extend its caching period to "All".

However, there is a commercial product exists that provides command line support and has the ability to get all items from the server.

  • That certainly worked. I just wonder if its possible to switch out of cached mode from Powershell. – sd_ Sep 9 '15 at 15:42
  • Unfortunately, you can't switch to Online mode from PowerShell. – thims Sep 9 '15 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.