Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm trying to get a connection from the connectionManager, but when I run the following code, I get my connection as null (which throws a nullreference exception later) Is there anyone who knows what the problem could be here? (can't debug... it's on production)


private static void CreateProfileMapping(ProfileSubtypeProperty psp, ConnectionManager cm, string mappedName)
    Connection connection = cm["AD"];
    if (connection == null)
        throw new NullReferenceException("Connection 'AD' is null");// -> triggers


SPServiceContext context = SPServiceContext.GetContext(site);
UserProfileConfigManager upcm = new UserProfileConfigManager(context);
ConnectionManager cm = upcm.ConnectionManager;

If I go to:

Central Administration -> Application Management -> Manage service applications -> User Profile Service Application -> Configure Synchronization Connections

There's only one connection and it's called "AD". (synchronising works btw)

This worked perfectly on test-server, but it always has to be production that fails...


Feature Activation: Activating Feature 'test.Intra.Solution_User Properties' (ID: '45af143f-0a5f-4021-9bbf-3ea4d8869120') at URL http://intranet.test. 0dd8bdd1-4d5f-4a5e-9695-0bfe64791072 Calling 'FeatureActivated' method of SPFeatureReceiver for Feature 'test.Intra.Solution_User Properties' (ID: '45af143f-0a5f-4021-9bbf-3ea4d8869120'). 0dd8bdd1-4d5f-4a5e-9695-0bfe64791072 LoadConnections failed trying to fill the connections list. Most likely during RetriveResources because of permissions --- {1}. Available parameters: System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (407) Proxy Authentication Required. ---> System.Net.WebException: The remote server returned an error: (407) Proxy Authentication Required. at System.Net.HttpWebRequest.GetResponse() at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) --- End of inner exception stack trace --- Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException... 0dd8bdd1-4d5f-4a5e-9695-0bfe64791072 ... responseException, ChannelBinding channelBinding) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Ru... 0dd8bdd1-4d5f-4a5e-9695-0bfe64791072 ...ntime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at System.ServiceModel.Description.IMetadataExchange.Get(Message request) at Microsoft.ResourceManagement.WebServices.MetadataClient.Get(String dialect, String identifier) at Microsoft.ResourceManagement.WebServices.Client.ResourceManagementClient.SchemaManagerImplementation.RefreshSchema() at Microsoft.ResourceManagement.WebServices.ResourceManager.get_SchemaManager() at Microsoft.ResourceManagement.WebServices.ResourceManager..ctor(String typeName, LocaleAwareClientHelper localePreferences, ContextualSecurityToken securityToken) at Microsoft.Office.Server.UserProfiles.ConnectionManag... 0dd8bdd1-4d5f-4a5e-9695-0bfe64791072 ...er.LoadConnections(Boolean fForUI) . 0dd8bdd1-4d5f-4a5e-9695-0bfe64791072 ConnectionManager.LoadConnections(): Could not find MOSS MA despite being marked as fully configured, was it deleted? 0dd8bdd1-4d5f-4a5e-9695-0bfe64791072

I guess it has something to do with this...

Is there anybody who knows a solution to this problem?

share|improve this question
Can you share the corresponding ULS and Event Logs for this.. –  Arko D Jul 12 '12 at 12:40
still nobody who knows the anwser? –  Ruben Herman Aug 2 '12 at 9:54
I am struggling with just about the same issue (though in PowerShell); only running as Farm account allows me to retrieve the connection managers. –  user17028 May 15 '13 at 15:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.