Forum Discussion

mttsow's avatar
mttsow
Occasional Contributor
4 years ago
Solved

Testcomplete 14 with Outlook 2016

Hi,  I have this error:   TypeError: NamespaceMAPI.Folders is not a function   with testcomplete 14 with Outlook 2016 with the following script. It worked in testcomplete12 with Outlook 2014.  ...
  • tphillips's avatar
    4 years ago

    The way we do this in our scripts is to use the mapiNamespace.Stores to find the account we're after:

        var testEmailStore;
        for (var i = 0; i < mapiNamespace.Stores.Count; i++) {
            store = mapiNamespace.Stores.Item(i + 1);
            // Ignore case of DisplayName, it can be entered in differently
            if (store.DisplayName.toLowerCase() == ProjectSuite.Variables.testEmailDisplayName.toLowerCase()) {
                Log.Message("Found email store for '" + ProjectSuite.Variables.testEmailDisplayName + "'")
                testEmailStore = store;
            }
        }

     

    We can then use testEmailStore to get the folders:

        var inbox = testEmailStore.Folders("Inbox")

    The whole Outlook OLE stuff is really annoying, there are so many ways to do one thing and most of the examples are in VB and are very old.