(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. (FR)
Reference (FR): Sahih Muslim 1907 b (FR)
In-book reference (FR): Book 33, Hadith 223 (FR)
USC-MSA web (English) reference(deprecated numbering scheme): Book 20, Hadith 4693 (FR)