Сannot get Contact folder using GetPredefinedFolder

Hello,
Is there anything wrong with this usage? Or an issue, cannot get Contact folder, always nothing! (Reading PSTs)

Dim ContactsFolder As FolderInfo = MyPST.GetPredefinedFolder(StandardIpmFolder.Contacts)

  • If there’s a short/fast way to check if at least 1 ipm.contact or ipm.distlist item is inside pst/ost please kindly advise, since GetPredefinedFolder doesnt work, I look through the whole pst and check each msg class, not efficient…

Thanks :slight_smile:

@australian.dev.nerds,

You can check the FolderInfo.ContainerClass property:

if (folder.ContainerClass == "IPF.Contact")

Hi, sure I can use that but it needs to loop through all folders, does it mean GetPredefinedFolder will not always work as expected?

@australian.dev.nerds,

In most cases, a result when GetPredefinedFolder method returns nothing means that there is no Contacts folder that Outlook uses by default. But at the same time there may be multiple “IPF.Contact” folders in PST. And the only way to get it is to go through all the folders.