Loan and attachment with codes

The following code demonstrates how to iterate over each attachment associated with a loan and extract it to disk.

using System;
using System.IO;
using EllieMae.Encompass.Client;
using EllieMae.Encompass.BusinessObjects;
using EllieMae.Encompass.BusinessObjects.Loans;

class ContactManager
{
public static void Main(string[] args)
{
// Open the session to the remote server
Session session = new Session();
session.StartOffline(“mary”, “maryspwd”);

// Open the loan using the GUID specified on the command line
Loan loan = session.Loans.Open(args[0]);

// Iterate over the list of attachments, saving them to the C:\Temp folder
foreach (Attachment att in loan.Attachments)
att.SaveToDisk(“C:\\Temp\\” + att.Name);

// Close the loan, discarding all of our changes
loan.Close();

// End the session to gracefully disconnect from the server
session.End();
}
}

You may also like...

Popular Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.