OutlookApi.NavigationModule Cast Error

Oct 14, 2015 at 8:02 PM
Edited Oct 14, 2015 at 8:28 PM
EDIT
After about 3 hours of trying to solve this problem on my own I posted this question. Literally 5-10 minutes after I posted this question I figured out that I can use "new Outlook._ContactsModule(NavigationModules.GetNavigationModule(OlNavigationModuleType.olModuleContacts))" and it will convert to a _ContactsModule and give me the .NavigationGroups property that I needed.

ORIGINAL POST

I'm trying to get a ContactsModule Object from outlook but I keep getting a cast error:

NetOffice.OutlookApi.NavigationModules NavigationModules = OutlookApp.Session.GetDefaultFolder(OlDefaultFolders.olFolderContacts).GetExplorer().NavigationPane.Modules;
NetOffice.OutlookApi.ContactsModule ContactsModule = NavigationModules.GetNavigationModule(OlNavigationModuleType.olModuleContacts);

I'm completely lost on what I'm doing wrong. Any ideas?