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”);
// Lock the loan since we will be modifying it
loan.Lock();
// Create a new attachment by importing it from a TIFF document on disk
Attachment att = loan.Attachments.Add(“C:\\Scanner Output\\MyAppraisal.tif”);
// Now attach the new Attachment to the Appraisal on the loan
LogEntryList appraisals = loan.Log.TrackedDocuments.GetDocumentsByTitle(“Appraisal”);
if (appraisals.Count > 0)
{
TrackedDocument appraisal = (TrackedDocument) appraisals[0];
appraisal.Attach(att);
}
// Save the changes to the loan, which commits the new attachment
loan.Commit();
loan.Close();
// End the session to gracefully disconnect from the server
session.End();
}
}