PrjMessagesCollection oPrjMessagesCollection = new PrjMessagesCollection(m_oTestProject);
if (m_oTestProject == null)
{
ProjectManager oProjManager = new ProjectManager();
m_oTestProject = oProjManager.CurrentProject;
}
if (m_oTestProject != null)
{
Page[] arrPages = m_oTestProject.Pages;
Function[] arrFunction = arrPages[5].Functions;
StorableObject oObject1 = arrFunction[0];
StorableObject oObject2 = arrFunction[1];
ProjectMessage oProjectMessage = oPrjMessagesCollection.AddMessage(Eplan.EplApi.EServices.IMessage.Region.Externals, 25, "XYZ", oObject1, false, oObject2, "Additional Text");
Console.WriteLine(" Addded message " + oProjectMessage.GetText() + " to the project");
}