Answered by Shaykh Hamza Karamali, SunniPath Academy Teacher
According to the Shafi school, can one offer 2 rakats of tahhiyatul masjid while the imam is delivering the Friday khutba?
In the Name of Allah, Most Merciful and Compassionate
Once the person delivering the Friday sermon (khateeb) sits on the pulpit (minbar), it is forbidden for those attending the Friday prayer to commence any prayer, and if they do so, the prayer is not effected (meaning that they are not considered to be praying if they start praying). Note that it becomes forbidden to commence a prayer once the khateeb sits on the pulpit even if he hasnt started delivering the sermon.
The only exception to this is 2 brief rakas of greeting the mosque for someone who enters the mosque and finds the khateeb delivering the sermon. It is sunna for such a person to pray 2 rakas, but these rakas must be quick and it would forbidden for him to lengthen them such that they would customarily be considered lengthy. It would be forbidden and invalid to pray more than 2 rakas or to pray 2 rakas for any reason other than greeting the mosque.
1. If the Friday prayer does not take place in a mosque, it is not permitted to pray the two rakas described above. Rather, one must sit down and listen to the sermon. In order for a place to be considered a mosque it must be endowed as a mosque; rented property is not considered an endowment (waqf), neither are prayer spaces in Islamic centers that were not endowed as mosques.
2. If one started praying before the khateeb climbed the pulpit, one must make ones prayer brief and finish it quickly once he does so.
3. It is permissible to intend the two rakas that are sunna before the Friday prayer along with the intention of greeting the mosque.
(al-Hawashi al-Madaniyya, 1.216)
And Allah knows best.