Abdullah bin Umar reported,

The Prophet ﷺ laid siege to the people of Taif but did not conquer the city, so he said, "We will depart tomorrow, Allah willing."The Muslims objected, saying, "Shall we leave without conquering it?"He said, "Then set out to fight in the morning."So they went out to fight and sustained wounds. The Prophet ﷺ then said, "We will depart tomorrow, Allah willing."This seemed to please them, and the Messenger of Allah ﷺ smiled.

Bukhari 7480

Sahih

حدثنا عبد الله بن محمد حدثنا ابن عيينة عن عمرو عن أبي العباس

عن عبد الله بن عمر قال

حاصر النبي ﷺ أهل الطائف فلم يفتحها فقال إنا قافلون غدا إن شاء الله فقال المسلمون نقفل ولم نفتح قال فاغدوا على القتال فغدوا فأصابتهم جراحات قال النبي ﷺ إنا قافلون غدا إن شاء الله فكأن ذلك أعجبهم فتبسم رسول الله ﷺ

البخاري 7480صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Tawhid
Chapter
Will and volition
Numbering
Darussalam 7480
Bukhari 7480