Encompass – code creates a new appointment to meet with a contact

The following code creates a new appointment to meet with a contact.

using System;
using System.IO;
using EllieMae.Encompass.Client;
using EllieMae.Encompass.BusinessObjects;
using EllieMae.Encompass.BusinessObjects.Calendar;
using EllieMae.Encompass.BusinessObjects.Contacts;
using EllieMae.Encompass.Query;

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

// Create a new appointment in the calendar that will start 3 hours from now
Appointment appt = session.Calendar.CreateAppointment(DateTime.Now.AddHours(3), DateTime.Now.AddHours(4));

// Set the appointments properties
appt.Subject = “Meet with Margaret Taylor re: rate lock”;
appt.Location = “220 W. Grand Ave.”;

// Set a reminder for an hour before the appointment
appt.ReminderEnabled = true;
appt.ReminderInterval = 60;

// Fetch the contact to attach to this appointment
StringFieldCriterion fnCri = new StringFieldCriterion();
fnCri.FieldName = “Contact.FirstName”;
fnCri.Value = “Margaret”;

StringFieldCriterion lnCri = new StringFieldCriterion();
lnCri.FieldName = “Contact.LastName”;
lnCri.Value = “Taylor”;

ContactList contacts = session.Contacts.Query(fnCri.And(lnCri), ContactLoanMatchType.None,
ContactType.Borrower);

// Add the contacts to the appointment
for (int i = 0; i < contacts.Count; i++)
appt.Contacts.Add(contacts[i]);

// Save the changes to the appointment
appt.Commit();

// 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.