Connecting to Sharepoint 2010 via DOTCMIS : exception authentication provider

1k views Asked by At

I am trying to connect to sharepoint 2010 using DOTCMIS in C#. In a very similar fashion to this question:

Connecting via CMIS (dotCMIS) to SP2010: exception unauthorised

(However, my code is running in a MSCRM 2011 custom workflow activity)

My code is:

        var parameters = new Dictionary<string, string>();

        parameters[SessionParameter.BindingType] = BindingType.AtomPub;
        parameters[SessionParameter.AtomPubUrl] = "http://mySPServer/sites/scans/_vti_bin/cmis/rest/MyRepositoryIDGUID?getRepositoryInfo";
        parameters[SessionParameter.User] = "MyUser";
        parameters[SessionParameter.Password] = "MyPassword";
        parameters[SessionParameter.AuthenticationProviderClass] = "DotCMIS.Binding.NtlmAuthenticationProvider";

        var sessionFactory = SessionFactory.NewInstance();
        return sessionFactory.GetRepositories(parameters)[0].CreateSession();

However whenever I run it I am currently getting the following exception:

Sif General Error: DotCMIS.Exceptions.CmisRuntimeException: Could not load authentictaion provider: Value cannot be null. Parameter name: type ---> System.ArgumentNullException: Value cannot be null. Parameter name: type at System.Activator.CreateInstance(Type type, Boolean nonPublic) at DotCMIS.Binding.Impl.CmisBinding..ctor(IDictionary2 sessionParameters, AbstractAuthenticationProvider authenticationProvider) --- End of inner exception stack trace --- at DotCMIS.Binding.Impl.CmisBinding..ctor(IDictionary2 sessionParameters, AbstractAuthenticationProvider authenticationProvider) at DotCMIS.Client.Impl.CmisBindingHelper.CreateAtomPubBinding(IDictionary2 parameters, AbstractAuthenticationProvider authenticationProvider) at DotCMIS.Client.Impl.SessionFactory.GetRepositories(IDictionary2 parameters, IObjectFactory objectFactory, AbstractAuthenticationProvider authenticationProvider, ICache cache) at TPR.SIF.WorkflowActivity.SessionService.CreateNewSession(String dmWebServiceUrl, String userName, String password) at TPR.SIF.WorkflowActivity.SifService.SetUpServices(CodeActivityContext codeActivityContext) at TPR.SIF.WorkflowActivity.SifService.Execute(CodeActivityContext codeActivityContext)

The error happens on the following line:

  sessionFactory.GetRepositories(parameters)[0].CreateSession();

which calls this line in the CMIS library

       if (sessionParameters.TryGetValue(SessionParameter.AuthenticationProviderClass, out authenticationProviderClass))
            {
                try
                {
                    Type authProvType = Type.GetType(authenticationProviderClass);
                     authenticationProvider = (AbstractAuthenticationProvider)Activator.CreateInstance(authProvType);

Does anyone know why "DotCMIS.Binding.NtlmAuthenticationProvider" cannot be created?

Thanks very much.

Sean.

1

There are 1 answers

3
Florian Müller On BEST ANSWER

NTLM support will released with DotCMIS 0.5. If you are using DotCMIS 0.4, it cannot work.