In the Sherlock episode His Last Vow we see in detail how Sherlock has plotted to gain access to the villain Magnussen's apartment despite tight security.
But when He gets there he finds that Mary is already there.
How did she gain access to the apartment?