E=mc2
asked on
Modify Powershell script to pause after reading each email
I would like to modify this part of a Powershell script so that when it looks through any new emails, that it separates each email with
a line so that it is distinguishable..
or that it pauses and asks the user if they want to continue checking.. (to pause after each email)
# Do/while loop for paging through the folder
do
{
# Set what we want to retrieve from the folder. This will grab the first $pagesize emails
$view = New-Object Microsoft.Exchange.WebServ ices.Data. ItemView($ numOfEmail sToRead,$i ndex)
# Retrieve the data from the folder
$findResults = $service.FindItems([Micros oft.Exchan ge.WebServ ices.Data. WellKnownF olderName] ::Inbox,$v iew)
foreach ($item in $findResults.Items)
{
# load the additional properties for the item
$item.Load($propertySet)
# Output the results
"From: $($item.From.Name)"
"Subject: $($item.Subject)"
}
# Increment $index to next block of emails
$index += $numOfEmailsToRead
} while ($findResults.MoreAvailabl e) # Do/While there are more emails to retrieve
a line so that it is distinguishable..
or that it pauses and asks the user if they want to continue checking.. (to pause after each email)
# Do/while loop for paging through the folder
do
{
# Set what we want to retrieve from the folder. This will grab the first $pagesize emails
$view = New-Object Microsoft.Exchange.WebServ
# Retrieve the data from the folder
$findResults = $service.FindItems([Micros
foreach ($item in $findResults.Items)
{
# load the additional properties for the item
$item.Load($propertySet)
# Output the results
"From: $($item.From.Name)"
"Subject: $($item.Subject)"
}
# Increment $index to next block of emails
$index += $numOfEmailsToRead
} while ($findResults.MoreAvailabl
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER