AddMessage(Region,Int32,String,StorableObject,Boolean,StorableObject,String) Method
Adds a new message to the database with electrotechnical messages (Project data\Messages\Management). Any existing message from the system can be added as well as messages registered by an add-in.
The following example shows how to append the new message 999025 to the message database of the current project.
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");
}