(45) باب قَوْلِهِ صلى الله عليه وسلم " إِنَّمَا الأَعْمَالُ بِالنِّيَّةِ." وَأَنَّهُ يَدْخُلُ فِيهِ الْغَزْوُ وَغَيْرُهُ مِنَ الأَعْمَالِ
It has been narrated through a different chain of transmitters on the authority of Sufyan who said that he heard 'Umar b. al-Khattab relate (this tradition) from the Prophet (ﷺ) while he was delivering a sermon from the pulpit. (JA)
Reference (JA): Sahih Muslim 1907 b (JA)
In-book reference (JA): Book 33, Hadith 223 (JA)
USC-MSA web (English) reference(deprecated numbering scheme): Book 20, Hadith 4693 (JA)