Committer: root <root@fruw.org>
This commit is contained in:
21
powershell/exp-look/LICENSE
Normal file
21
powershell/exp-look/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 fruworg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
30
powershell/exp-look/explook.ps1
Normal file
30
powershell/exp-look/explook.ps1
Normal file
@ -0,0 +1,30 @@
|
||||
Write-Host '
|
||||
_______________ _____________.____ ________ ________ ____ __.
|
||||
\_ _____/\ \/ /\______ \ | \_____ \ \_____ \ | |/ _|
|
||||
| __)_ \ / | ___/ | / | \ / | \| <
|
||||
| \ / \ | | | |___/ | \/ | \ | \
|
||||
/_______ //___/\ \ |____| |_______ \_______ /\_______ /____|__ \
|
||||
\/ \_/ \/ \/ \/ \/
|
||||
'
|
||||
Add-Type -AssemblyName "Microsoft.Office.Interop.Outlook" | Out-Null
|
||||
$olFolders = "Microsoft.Office.Interop.Outlook.olDefaultFolders" -as [type]
|
||||
$Outlook = New-Object -ComObject Outlook.Application
|
||||
$Namespace = $Outlook.GetNameSpace("MAPI")
|
||||
$Folder = $namespace.Folders("im@fruw.org").Folders("foldername")
|
||||
$Path = "$(pwd)\exp-look.csv"
|
||||
$i = $max = $Folder.Items.Count
|
||||
$Writed = 0
|
||||
if (!(Test-Path -Path $Path)) {
|
||||
'Тест1;Тест2' | Out-File $Path -Encoding UTF8
|
||||
}
|
||||
for(;$i -gt 0;$i--){
|
||||
if ($Folder.Items[$i].Unread){
|
||||
$Writed++
|
||||
$Folder.Items[$i].Unread = $False
|
||||
$Percent = 100-($i/$max*100)
|
||||
Write-Progress -Activity "Работаем!" -Status "Осталось прочитать $i у.е." -PercentComplete $Percent
|
||||
$MailInfo = $Folder.Items[$i] | Select-Object -Property Body, Subject, ReceivedTime, SenderName, SenderEmailAddress
|
||||
$MailInfo | Out-File $Path -Append -Encoding UTF8
|
||||
}}
|
||||
Read-Host -Prompt " Выполнено! Внесено в таблицу $Writed у.е.
|
||||
Нажмите Enter для того, чтобы выйти"
|
Reference in New Issue
Block a user