As you know, the original sentence is vague. John called Sam to give him the code to the safe (John knows it, and Sam doesn't). John called Sam to get the code to the safe (Sam knows it, but John doesn't). Joyeux Noël.
What do you think? John called Sam to give him the code to the safe - John knows it John called Sam for him to give the code to the safe - Sam knows it