How to: Change the Default Separator Character for Entering Multivalue Properties

This code example changes the default separator character for users entering multiple values for a property in the user interface. The comma is the default separator character. Administrators can also change the separator character directly in the user interface.

Replace servername and PublishedPapers with actual values before running the code example. Also add references to the following in your Microsoft Visual Studio project:

  • Microsoft.Office.Server

  • Microsoft.SharePoint

  • System.Web

Example

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Server;
using Microsoft.Office.Server.Administration;
using Microsoft.Office.Server.UserProfiles;
using Microsoft.SharePoint;
using System.Web;

namespace UserProfilesApp
{
    class Program
    {
        static void Main(string[] args)
        {

            using (SPSite site = new SPSite("https://servername"))
            {
                ServerContext context =
                    ServerContext.GetContext(site);
                UserProfileManager profileManager = new
                    UserProfileManager(context);
                PropertyCollection pc = profileManager.Properties;
                Property property = 
                    pc.GetPropertyByName("PublishedPapers");
                property.Separator = MultiValueSeparator.Semicolon;
                property.Commit();
          
            }
        }
    }
}

See Also

Tasks

How to: Create Multivalue Properties
How to: Set Multiple Values to a Multivalue Property
How to: Create Properties with Choice Lists
How to: Set Privacy Policies for User Profile Properties