It may be remembered that al-Qaim had commanded the Fatimid naval forces in 301/913. The Fatimid fleet sailed from Mahdiya towards the northern coast of Egypt and returned to Raqada after conquering Tripoli. In the following year Hubasa bin Yousuf set off east and conquered Surt and Ajabiyya on 7th Rajab, 301, February 6, 914 he entered Barqa. On Thursday the 14th Zilhaja, 301/July 7, 914 al-Qaim followed him from Raqada with a large army. Contrary to his orders, Hubasa, without waiting for his arrival, pushed further east and invaded Alexandria on 2nd Safar, 302/August 27, 914. Al-Qaim arrived there on Friday the 14th Rabi II, 302/November 4, 914. The Abbasids succeeded to prevent the Fatimid's entry in Egypt. At his withdrawal from Egypt, al-Qaim however left a garrison in Barqa.
In 307/919, the second attempt had been conducted at the command of al-Qaim. He set out eastward on Monday the 1st Zilkada, 306/April 5, 919. On Friday the 8th Safar, 307/July 9, 919 the vanguard of the army arrived in Alexandria. This time the Fatimid forces made an advance right upto the Egyptian capital before they were repulsed. These two invasions were launched during the period of Imam al-Mahdi. After his succession, al-Qaim made a third attempt in 323/935 under the command of Raydan. Muhammad bin Tughj al-Ikhshidid (323-334/935- 946), the then governor of Egypt, repelled this attack, forcing the Fatimid forces to withdraw to Barqa. Nothing was gained in these three campaigns, but it made a way open for the next period to the Fatimid to occupy Egypt.
(more on egypt 1 2 3)