• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Edit
Show / Hide Table of Contents

Create an appointment using services

Some tooltip text!
• 1 minute to read
 • 1 minute to read

This example shows you how to create an appointment using NetServer services. The new appointment will be added to the diary of associate 103 by the logged-in user is SAL0.

Code

using SuperOffice.CRM.Services;
using SuperOffice;

using(SoSession newSession = SoSession.Authenticate("SAL0", ""))
{
  //Create an appointment agent
  using(AppointmentAgent appointmentAgent = new AppointmentAgent())
  {
    //Create an appointment entity through the appointment agent
    AppointmentEntity myAppointment = appointmentAgent.CreateDefaultAppointmentEntityByTypeAndAssociate(SuperOffice.Data.TaskType.Appointment, 103);

    //Assign values to some of the properties of the appointment
    myAppointment.Location = "5th Floor,Seminar Room";
    myAppointment.AlarmLeadTime = TimeSpan.FromMinutes(10.00);
    myAppointment.StartDate = DateTime.Today.AddDays(5);
    myAppointment.EndDate = DateTime.Today.AddDays(5);
    myAppointment.HasAlarm = true;
    myAppointment.Description = "this is a new appointment";
    myAppointment.AlldayEvent = true;

    //Save the newly created appointment in the database
    appointmentAgent.SaveAppointmentEntity(myAppointment);
  }
}

Walk-through

In the example, we create an Appointment using the CreateDefaultAppointmentEntityByTypeAndAssociate method exposed through the agent. The method requires 2 parameters:

  • the type of the requested task
  • the AssociateID - the ID for whom the appointment should be created
In This Article
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top