Aḥmad Riḍā Khān Barelwī writes:
A translation is as follows:
“It is without a doubt that the Almighty has given His Noble Beloved (Allāh bless him and grant him peace) the complete knowledge of earlier and later ones. From the east to the west, from the Throne till the earth, everything was shown to him. He was made witness to the Kingdom of the heavens and the earth. From the very first day till the last day all of the knowledge of what was and what shall be (mā kāna wa mā yakūn) has been told to him. From all of the above, not even an iota is outside the knowledge of the Prophet. The great knowledge of the Noble Beloved (Allāh bless him and grant him peace) encompasses all of these. It is not just of a summary type but what is small and big, every leaf that falls and every grain in the darkness of the earth are in their entirety known to him individually and in detail. Much praise to Allāh. In fact, that which has been discussed is not, never, the complete knowledge of the Messenger of Allāh (Allāh bless him and grant him peace and send peace on his family and companions, all of them); but this is a small part of the Prophet’s knowledge …” (Inbā’ al-Muṣṭafā; in: Fatāwā Riḍawiyyah, Riḍā Foundation, 29:487)
This is an example of Aḥmad Riḍā Khān Barelwī’s extremism in describing the knowledge of the Prophet (ṣallallāhu ‘alayhi wasallam).
The books of the Ḥanafī school are clear that such a belief is blasphemous. It states in al-Fatāwā al-Bazzāziyyah: “A [man] weds [a woman] without witnesses, saying: ‘I make the Messenger of Allāh and Angels witness’, he has become a Kāfir, because he believes that the Messenger and Angel know the Ghayb, as distinguished from his saying: ‘I make the angel on the left shoulder and the angel on the right shoulder witness’, he would not become Kāfir, because they are aware [of that].” (al-Fatāwā al-Bazzāziyyah, 6:325) In al-Muḥīṭ al-Burhānī (Idārat al-Qur’ān, 7:407), the same mas’alah is found ending with: “because they are aware of that as they are not absent from him.”
Moreover, according to a mutawātir ḥadīth that is clear in its meaning, the Prophet (ṣallallāhu ‘alayhi wasallam) foretold that on Judgement Day there will be people driven away from him that he will call and he will be told by Allāh/Angels that he has no knowledge of what they did. See here. This is categorical in showing the Prophet (ṣallallāhu ‘alayhi wasallam) did not have complete and detailed knowledge of all creation in the manner that Aḥmad Riḍā Khān Barelwī describes.
Furthermore, the Prophet (ṣallallāhu ‘alayhi wasallam) sought protection from knowledge that is of no benefit, as found in Ṣaḥīḥ Muslim. That the Prophet made this supplication is reported by several ṣaḥābah including ‘Abdullāh ibn ‘Amr, Abū Hurayrah, Anas ibn Mālik and Zayd ibn Arqam with authentic chains – making it close to a categorically established ḥadīth. Knowledge of no benefit would of course include useless knowledge of the world, let alone knowledge of dirty and filthy things which is unbefitting the Prophet (ṣallallāhu ‘alayhi wasallam). Hence, the Prophet (ṣallallāhu ‘alayhi wasallam) also said: “You are more aware of the matters of your world.” (Ṣaḥīḥ Muslim)