Nakkeeran Natarajan
Feb 19, 20191 min
Updated: Mar 29, 2019
n this article we will be seeing how to get the User Profile Synchronization Connection names from SharePoint 2010.
Through UI you can view the Synchronization connections in Central Administration => Application Management =>Manage service applications =>User Profile Service Application => Configure Synchronization Connections.
Using C# code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.Office.Server;
using Microsoft.Office.Server.UserProfiles;
using System.Web;
namespace UP
{
class Program
{
static void Main(string[] args)
{
using (SPSite site = new SPSite("http://serverName:12345/"))
{
//get the server context
ServerContext context = ServerContext.GetContext(site);
UserProfileConfigManager upcm = new UserProfileConfigManager(context);
ConnectionManager cm = upcm.ConnectionManager;
foreach (Connection cn in cm)
{
Console.WriteLine("Connection Name:" + cn.DisplayName.ToString());
}
Console.ReadLine();
}
}
}
}
erver'>