In Ba’Alawi’s Bughyat al-Mustarshidin p. 308, 369, it is related from ‘Allamah Muhammad b. Sulayman al-Kurdi al-Shafi’i [d. 1194 H] that he said,
“Regarding tawassul through the Prophets and pious, it is a liked matter, established in authentic hadiths. Its desirability is agreed-upon. In fact, tawassul is established through good deeds, and they are a’rad (fleeting accidents); thus, with dhawat (substances) a fortiori.
“Regarding making intermediaries between the slave and His Lord:
“If he asks them [i.e. the intermediaries] like he asks Allah in matters [i.e. directly], believing that they bring about effects in a matter and not Allah, then that is disbelief.
“And if the intention is tawassul through them to Allah, the Exalted, in the fulfilment of important matters, while believing that Allah is He who causes all benefit and harm in matters, and the one who brings about effects in matters, then apparently this is not disbelief, although his action is despicable.”
From http://www.shafiifiqh.com/asking-hel…-intermediary/ with slight amendments: