In 1708, Leszczyński appointed Poniatowski his personal representative to Charles XII. He participated in the Battle of Holowczyn that year, and served as an aide to Charles XII during his exile in the Ottoman Empire after the Battle of Poltava in 1709. Here, he worked to establish an alliance between the Ottomans and the Swedes, aiming to bring the Ottomans into the war against Russia. Due to diplomatic efforts on the part of the French, aligned with Sweden, the Ottomans began to campaign against the Russians in 1710. With this change in Ottoman foreign policy came the dismissal of Çorlulu Ali Pasha, Grand Vizier of Ahmed III. His successor, Köprülü Numan Pasha, was an acquaintance of Poniatowski and had been a supporter of an anti-Russian shift in Ottoman politics.