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”);
// Open and lock the next loan in the loop
Loan loan = session.Loans.Folders[“My Pipeline”].OpenLoan(“Sample”);
// Get all Appraisals from the TrackedDocument list
LogEntryList appraisals = loan.Log.TrackedDocuments.GetDocumentsByTitle(“Appraisal”);
// Save each attachment to the C:\Appraisals folder
foreach (TrackedDocument appraisal in appraisals)
foreach (Attachment att in appraisal.GetAttachments())
att.SaveToDisk(“C:\\Appraisals\\” + att.Name);
loan.Close();
// End the session to gracefully disconnect from the server
session.End();
}
}