According to following Quranic verse messenger does not know what will happen to him or others in the hereafter
I am no different from the other messengers, nor do I know what will happen to me or to you. I only follow what is inspired to me. I am no more than a clear warner" [46:9]
but according to hadiths messenger knew people who are guaranteed a place in Janna(famous hadith about 10) :
AbdurRahman ibn al-Akhnas said that when he was in the mosque, a man mentioned Ali (may Allah be pleased with him). So Sa'id ibn Zayd got up and said: I bear witness to the Apostle of Allah (peace be upon him) that I heard him say: Ten persons will go to Paradise: The Prophet (peace be upon him) will go to Paradise, Abu Bakr will go to Paradise, Umar will go to Paradise, Uthman will go to Paradise, Ali will go to Paradise, Talhah will go to Paradise: az-Zubayr ibn al-Awwam will go to paradise, Sa'd ibn Malik will go to Paradise, and Abdur Rahman ibn Awf will go to Paradise. If I wish, I can mention the tenth. The People asked: Who is he: So he kept silence. The again asked: Who is he: He replied: He is Sa'id ibn Zayd.
Narrated Abdur Rahman bin Awf: that the Messenger of Allah () said: "Abu Bakr is in Paradise, 'Umar is in Paradise, 'Uthman is in Paradise, 'Ali is in Paradise, Talhah is in Paradise, Az-Zubair is in Paradise, 'Abdur Rahman bin Awf is in Paradise, Sa'd bin Abi Waqqas is in Paradise, and Abu 'Ubaidah bin Al-Jarrah is in Paradise."
Jami At Tirmidhi
Narrated Safwan bin Muhriz:
A man asked Ibn 'Umar, "What have you heard from Allah's Apostle regarding An-Najwa?" He said, "Everyone of you will come close to His Lord Who will screen him from the people and say to him, 'Did you do so-and-so?' He will reply, 'Yes.' Then Allah will say, 'Did you do so-and-so?' He will reply, 'Yes.' So Allah will question him and make him confess, and then Allah will say, 'I screened your sins in the world and forgive them for you today.' " Volume 9, Book 93, Number 605 Sahih Buckari
. Isn't this a contradiction of the above Quranic verse?