Killing CAM would've left John looking responsible. Sherlock came in by invitation, there were no traces of Mary in the office - John was the only one not allowed to be there when the police shows up.
I still don't believe Sherlock wouldn't have been able to prove his innocence also he didn't have any motive nor connection to Magnussen at the time it happened, and they wouldn't have found any weapon, unless Mary deliberatly had left it there (with no fingerprints on it). And Sherlock wasn't really invited, he came in illegally too thanks to Janine to steal the letters, but this is another point.
But seriously there were no cameras in the office? (another question just came up to my mind)













