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