كتاب المغازى
64  
Military Expeditions led by the Prophet (pbuh) (Al-Maghaazi)
(56)
Chapter: The Ghazwa of At-Taif
(56)
باب غَزْوَةُ الطَّائِفِ فِي شَوَّالٍ سَنَةَ ثَمَانٍ
Sahih al-Bukhari 4325

Narrated `Abdullah bin `Amr:

When Allah's Messenger (ﷺ) besieged Taif and could not conquer its people, he said, "We will return (to Medina) If Allah wills." That distressed the Companions (of the Prophet (ﷺ) and they said, "Shall we go away without conquering it (i.e. the Fort of Taif)?" Once the Prophet (ﷺ) said, "Let us return." Then the Prophet said (to them), "Fight tomorrow." They fought and (many of them) got wounded, whereupon the Prophet (ﷺ) said, "We will return (to Medina) tomorrow if Allah wills." That delighted them, whereupon the Prophet (ﷺ) smiled. The sub-narrator, Sufyan said once, "(The Prophet) smiled."

حَدَّثَنَا عَلِيُّ بْنُ عَبْدِ اللَّهِ، حَدَّثَنَا سُفْيَانُ، عَنْ عَمْرٍو، عَنْ أَبِي الْعَبَّاسِ الشَّاعِرِ الأَعْمَى، عَنْ عَبْدِ اللَّهِ بْنِ عُمَرَ، قَالَ لَمَّا حَاصَرَ رَسُولُ اللَّهِ صلى الله عليه وسلم الطَّائِفَ فَلَمْ يَنَلْ مِنْهُمْ شَيْئًا قَالَ ‏"‏ إِنَّا قَافِلُونَ إِنْ شَاءَ اللَّهُ ‏"‏‏.‏ فَثَقُلَ عَلَيْهِمْ وَقَالُوا نَذْهَبُ وَلاَ نَفْتَحُهُ ـ وَقَالَ مَرَّةً نَقْفُلُ ـ فَقَالَ ‏"‏ اغْدُوا عَلَى الْقِتَالِ ‏"‏‏.‏ فَغَدَوْا فَأَصَابَهُمْ جِرَاحٌ فَقَالَ ‏"‏ إِنَّا قَافِلُونَ غَدًا إِنْ شَاءَ اللَّهُ ‏"‏‏.‏ فَأَعْجَبَهُمْ فَضَحِكَ النَّبِيُّ صلى الله عليه وسلم، وَقَالَ سُفْيَانُ مَرَّةً فَتَبَسَّمَ‏.‏ قَالَ قَالَ الْحُمَيْدِيُّ حَدَّثَنَا سُفْيَانُ الْخَبَرَ كُلَّهُ‏.‏
Reference : Sahih al-Bukhari 4325
In-book reference : Book 64, Hadith 355
USC-MSA web (English) reference : Vol. 5, Book 59, Hadith 615
  (deprecated numbering scheme)