I have a VSTO Outlook 2007 Add-in. I have to check whether Outlook is Offline / Online with exchange server. I am using the code as below:
NameSpace ns = Application.GetNamespace("MAPI");
MAPIFolder publicFolder = ns.GetDefaultFolder(OlDefaultFolders.olPublicFoldersAllPublicFolders);
if (publicFolder == null)
{
offline = true;//Flag is set to tell it is offline
}
Earlier this code was working fine. But all of a sudden the line to get public folders started returning null even when Outlook is online.
I came to know that public folders have been removed from the exchange server that's why it is returning null.
Can anyone please tell me any alternative & standard way of checking whether Outlook is online with exchange server?
Thanks & best regards, Nadeem Ullah