 In 1709 during the War of the Spanish Succession he was appointed papal nuncio in Vienna with the aim of defending the feudal rights of the Holy See and of reclaiming territories occupied by the Empire, an aim eventually foiled by the death of the Emperor Joseph I in 1711.In 1710 he went to Dresden where he was instrumental in securing the conversion of the future King Augustus III of Poland from Lutheranism to Roman Catholicism.He continued to be active in papal diplomacy until the 1740s.