Episode 97, The Call of Nature - 1968 (27:54 Kirk in the bog on the planet Rajella 7)
Now I am unsure whether this is canon.
If he'd used his communicator rather than writing on a bathroom wall this wouldn't have happened.
Still it would be funny seeing him appear in the Transporter Room...
...having a Shatner.