CreatePreference

Creates a new preference or a new preference category

This method creates either a new preference or a new preference category.

  • Preferences that are inside the same category must have unique private names
  • Uncategorised preferences must have unique private names
  • All categories must have unique private names
  • Preferences and categories can have the same public names

Creating a preference outside of a category

  1. Set the value of the isPreference key to true
  2. Set the value of the CategoryId key to null

Creating a preference inside a category

  1. Set the value of the isPreference key to true
  2. Set the value of the CategoryId key to the ID of an existing category

Creating a preference category

  1. Set the value of the isPreference key to false
  2. Set the value of the CategoryId key to a unique integer

SOAP action: http://apiconnector.com/v2/ApiService/CreatePreference

πŸ“˜

Input and output parameters

Input parameters

  • PublicName - required; string
  • PrivateName - string (Default: PublicName string)
  • IsPreference - boolean (Default: false)
  • Order - string (int, 'top', 'bottom')
  • IsPublic - boolean (Default: false)
  • CategoryID - int (Default for preferences: 0. Default for preference categories: null)

Output parameters

  • ID - integer
  • PublicName - string
  • PrivateName - string
  • IsPreference - boolean
  • Order - string (int, 'top', 'bottom')
  • IsPublic - boolean
  • CategoryID - integer
  • PreferenceCount - integer
  • Created - DateTime
  • LastModified - DateTime

Example

using (var client = new ApiServiceClient())
{
  client.ClientCredentials.UserName.UserName = "username";
  client.ClientCredentials.UserName.Password = "password";

  var preference = new ApiPreference {
      PublicName: "Preferred contact method",
      PrivateName: "Preferred contact method",
      IsPreference: false,
      Order: "top",
      IsPublic: false,
      CategoryId: null
    }
  var createdContact = client.CreatePreference(preference);
}