In Spanish, when do you use "Le" or "Lo" when it comes to a masculine noun receiving an action?

For example. Why is it correct to say "Le he dicho (I have told him)" instead of "Lo he dicho?
2 answers 2