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

How to create an invitation (data layer)

Some tooltip text!
• 2 minutes to read
 • 2 minutes to read

After creating an appointment you may need to invite members. The following example demonstrates how this is done.

using SuperOffice.CRM.Entities;
using SuperOffice.CRM.Rows;
using SuperOffice.Data;
using SuperOffice;
using(SoSession mySession = SoSession.Authenticate("SAL0", ""))
{
  //Create a New Appointment
  Appointment appointmentOne = Appointment.CreateNew();
  appointmentOne.SetDefaults();
  appointmentOne.AlldayEvent = 1;
  appointmentOne.DoBy = DateTime.Now.AddHours(8);
  appointmentOne.Task = TaskRow.GetFromIdxTaskId(14);
  appointmentOne.AppointmentText = TextRow.CreateNew();
  appointmentOne.AppointmentText.Text = "This is a Project Meeting";

  //Retrieve a person to invite
  Person invitee = Person.GetFromIdxPersonId(5);

  //Add attendee to the Appointment
  SuperOffice.CRM.Services.ParticipantInfo[] participants = new SuperOffice.CRM.Services.ParticipantInfo[1];
  participants[0] = new SuperOffice.CRM.Services.ParticipantInfo();

  //Set the properties of the attendee
  participants[0].AssociateId = invitee.AssociateId;
  participants[0].PersonId = invitee.PersonId;
  participants[0].SendEmail = false;
  RecurrenceUpdateMode recurrenceMode = RecurrenceUpdateMode.OnlyThis;

  //Add the appointment to the appointmentMatrix
  AppointmentMatrix appType = new AppointmentMatrix(appointmentOne, recurrenceMode);
  appType.AddParticipant(participants);

  //Save the appointment
  appType.Save();
}

In this example, we have initially created an appointment and set certain properties of it.

Attendees

A Person entity is used for adding as a attendee to this appointment.

In the latter part of the example, we have set some properties of the attendee such as AssociateId, PersonId, and SendEmail. You can create an array of ParticipantInfo as we have done above.

AppointmentMatrix

An instance of the AppointmentMatrix is created by passing the newly created appointment. You can add the attendees to the matrix by using the AddParticipant method.

When the AppointmentMatrix is saved, 2 records will be added to the appointment table:

  • One corresponding to the creator of the appointment
  • One referring to the attendee

If we have added more attendees, more records will be entered into the appointment table.

See also

  • Appointment table
  • Invitations
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top