using System;
using System.IO;
using EllieMae.Encompass.Client;
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();
// Open each loan in the folder and check the expected closing date
for (int i = 0; i < ids.Count; i++)
{
// Open and lock the next loan in the loop
Loan loan = fol.OpenLoan(ids[i].LoanName);
loan.Lock();
// Add a new supporting document to the loan
TrackedDocument doc = loan.Log.TrackedDocuments.Add(“My Custom Document”,
session.Loans.Milestones.Submittal.Name);
doc.OrderDate = DateTime.Now;
doc.DueDays = 10;
// Close the loan
loan.Commit();
loan.Unlock();
loan.Close();
}
// End the session to gracefully disconnect from the server
session.End();
}
}