Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

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("http://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

Community Additions

ADD
Show:
© 2015 Microsoft