Generally I don't think there is there a way to detect it.
Some email folders may include \Noselect flag - that would indicate you can't select such folder. You can access it using
I'm afraid however, that in case of Calendar and Contact they can be selected, but are empty, and I'm not aware of a better way of filtering them out than using their names.
It would be good to look at the logs just to be sure.