The following code produces a report of all the loans in the My Pipeline folder which are currently waiting to be sent to processing.
using System;
using System.IO;
using EllieMae.Encompass.Client;
using EllieMae.Encompass.BusinessEnums;
using EllieMae.Encompass.BusinessObjects;
using EllieMae.Encompass.BusinessObjects.Loans;
using EllieMae.Encompass.BusinessObjects.Loans.Logging;
class LoanReader
{
public static void Main()
{
// Open the session to the remote server
Session session = new Session();
session.Start(“myserver”, “mary”, “maryspwd”);
// Get the “My Pipeline” folder
LoanFolder fol = session.Loans.Folders[“My Pipeline”];
// Retrieve the folder’s contents
LoanIdentityList ids = fol.GetContents();
// Get the Processing Milestone
Milestone processing = session.Loans.Milestones.Processing;
// Open each loan in the folder and check the expected closing date
for (int i = 0; i < ids.Count; i++)
{
// Open the next loan in the loop
Loan loan = fol.OpenLoan(ids[i].LoanName);
// Check if this is in the Processing stage
if ((loan.Log.MilestoneEvents.NextEvent != null) &&
(loan.Log.MilestoneEvents.NextEvent.MilestoneName == processing.Name))
Console.WriteLine(“The loan \”” + loan.LoanName + “\” is waiting to be sent for processing.”);
// Close the loan
loan.Close();
}
// End the session to gracefully disconnect from the server
session.End();
}
}