Jump to content

Outlook Offline


rogerd2u
 Share

Recommended Posts

Has anyone created a script (or would be willing to help me create a script) to check if Outlook is offline? I want to have a script that will check to see if Outlook (2003/2007) is offline. If it is, I want the script to set Outlook online.

Any help will be GREATLY appreciated.

When doing a search through the forum, I found the following code snipet, but I'm having trouble getting it to work:

Const $PR_STORE_OFFLINE = 0x6632000B

ConsoleWrite(IsOutlookOnline() & @CR)

;MsgBox(0, "Outlook Offline?", IsOutlookOnline())

$outlookstatus = IsOutlookOnline()

$on = "online"

$off = "offline"

if $outlookstatus = 0 then msgbox(0, "", $off)

if $outlookstatus = 1 then msgbox(0, "", $on)

Func IsOutlookOnline()

Local $oSession, $oInfoStore, $bOffline

$oSession = ObjCreate("MAPI.Session")

; Use the existing Outlook session

$oSession.Logon ("", "", False, False)

$oInfostore = $oSession.GetInfoStore($oSession.Inbox.StoreID)

; Check if it's offline

$bOffline = $oInfostore.Fields($PR_STORE_OFFLINE) ;PR_STORE_OFFLINE

$oInfoStore = 0

$oSession = 0

If $bOffline Then

Return 0

$OutlookOffline = "Yes"

Else

Return 1

$OutlookOffline = "No"

EndIf

EndFunc

Edited by rogerd2u

Roger O."When people show you who they are, believe them.” --Mark Twain

Link to comment
Share on other sites

Thanks for the assistance!

When I run the script, it always says Outlook is online, even when I manually set Outlook to "Work Offline." I'm currently using Outlook 2003.

BTW: I have updated my script in my original post.

When you run the script, you need to give IsOutlookOnline() a variable name. example:

$outlookstatus = IsOutlookOnline()

$on = "online"

$off = "offline"

if $outlookstatus = 0 then msgbox(0, "", $off)

if $outlookstatus = 1 then msgbox(0, "", $on)

Edited by rogerd2u

Roger O."When people show you who they are, believe them.” --Mark Twain

Link to comment
Share on other sites

I have looked through the link you provided but came up empty-handed. :)

Is it possible to just create a script that will switch to Outlook and then read the status in the lower right-hand corner; or possibly one that could check for the presence of a checkmark next to "Work Offline" (Open Outlook --> Alt-F --> Look for checkmark on "Work Offline")?

hmmm, I wonder if it is checking to see if the server is available or not. You may want to check MSDN to see what the object model is of Outlook.

http://msdn.microsoft.com/en-us/library/aa221870.aspx

Roger O."When people show you who they are, believe them.” --Mark Twain

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...