Posts

Showing posts with the label Outlook

Outlook "Work Offline" Mode

 Since I've mainly only found this in terms of a VB Script. I'm going to post my version of it in PowerShell for anyone who is looking for something similar.  1: #Check if Outlook is online or offline mode 2: $Outlook = New-Object -ComObject Outlook.Application; 3: $State = if ($outlook.session.offline) {"Outlook has been set to work offline mode." } else { "Healthy - Outlook is in online mode." }; 4: $State; 5: 6: 7: #Toggle Outlook to online mode 8: Try { 9: $Outlook = New-Object -ComObject Outlook.Application 10: $State = "Toggle" 11: if ($outlook.session.offline) 12: { 13: $Outlook.ActiveExplorer().CommandBars.ExecuteMSO("ToggleOnline") 14: } 15: else 16: { 17: "Outlook already in online mode." 18: } 19: ConvertTo-Json($State) 20: } 21: Catch 22: { 23: If ($_.Exception.Message.Contains("Class not registered")) 2...

Using an Outlook Object to send email

Greetings fellow travels. It has been a while since I have posted anything so I thought I would add a small tidbit to answer that question of "How do I send a freak'n email?" of course this version uses your MSFT Outlook client. It is very difficult, so difficult I went "That's It" and was in shock that is was actually that simple. The other caveat is that this sends the email in HTML format so you can add all your favorite HTML tags. This is a really simple version and I didn't get very deep but there is lots of things you can actually do with the email. There are several good pages on the web that go into greater detail and get more in depth (and complex). But for my needs this is more than enough. Enjoy! $Outlook = New-Object -ComObject Outlook.Application $Mail = $Outlook.CreateItem(0) $Mail.To = $Address If (!([string]::IsNullOrWhiteSpace($CCAddress))) {     $Mail.CC = $CCAddress } $Mail.Subject = $Subject $Mail.HTMLBody = $HtmlBo...