using System;
using System.IO;
using EllieMae.Encompass.Client;
using EllieMae.Encompass.BusinessObjects;
using EllieMae.Encompass.BusinessObjects.Contacts;
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 Business Contact in the database
BizContact contact = (BizContact) session.Contacts.Open(int.Parse(args[0]), ContactType.Biz);
// Print all of the notes for the contact
for (int i = 0; i < contact.Notes.Count; i++)
{
Console.WriteLine(“Timestamp: ” + contact.Notes[i].Timestamp);
Console.WriteLine(“Subject: ” + contact.Notes[i].Subject);
Console.WriteLine(contact.Notes[i].Details);
}
// Now add a new note. We do not have to call Commit() to save to database —
// the act of adding it saves it to the server.
ContactNote newNote = contact.Notes.Add(“The subject of the note”, “The body of the note”);
Console.WriteLine(“New note created with ID ” + newNote.ID);
// Modify the note and save it
newNote.Subject = “The corrected subject of the note”;
newNote.Commit();
// End the session to gracefully disconnect from the server
session.End();
}
}