Objective

To get Itemid (menu link ID) of a specific Joomla article.

Function

/**
* Gets Itemid of specific article
*/
function getArticleItemid($articleId)
{
$link = 'index.php?option=com_content&view=article&id='.(int)$articleId;
$menu = JFactory::getApplication()->getMenu();
$menuItem = $menu->getItems('link', $link, true);
$Itemid = $menuItem->id;

return $Itemid;
}

Source: