Sunan an-Nasa'i, Book 8, Hadith 28 (Nasa'i 717)

It was narrated from 'Amr bin Shu'aib, from his father, from his grandfather, that the Prophet (ﷺ) forbade reciting poetry in the Masjid.