Question

I want to get the SharePoint document library data using CMIS

Here is my code:

Dictionary<string, string> parameters = new Dictionary<string, string>();
                parameters[SessionParameter.BindingType] = BindingType.AtomPub;
                parameters[SessionParameter.AtomPubUrl] = "http://zeus:18439/_vti_bin/cmis/rest/CD4E6A20-32DD-46F5-96A8-00EF7B754EC2?getRepositoryInfo";
                parameters[SessionParameter.User] = strSourceUserName;
                parameters[SessionParameter.Password] = strSourcePassword;
                SessionFactory factory = SessionFactory.NewInstance();
                migrateRepos = factory.GetRepositories(parameters);

I am getting an Unauthorized exception at GetRepositories() method. The stack trace is

at DotCMIS.Binding.AtomPub.AbstractAtomPubService.Read(UrlBuilder url)
   at DotCMIS.Binding.AtomPub.AbstractAtomPubService.GetRepositoriesInternal(String repositoryId)
   at DotCMIS.Binding.AtomPub.RepositoryService.GetRepositoryInfos(IExtensionsData extension)
   at DotCMIS.Binding.Impl.BindingRepositoryService.GetRepositoryInfos(IExtensionsData extension)
   at DotCMIS.Client.Impl.SessionFactory.GetRepositories(IDictionary`2 parameters, IObjectFactory objectFactory, AbstractAuthenticationProvider authenticationProvider, ICache cache)
   at DotCMIS.Client.Impl.SessionFactory.GetRepositories(IDictionary`2 parameters)
   at ReadFileInfo.AlfrescoAnalysis.MigrateCMISData() in D:\TFS\Optimum - MigrationTools\Alfresco_Analysis\ReadFileInfo\AlfrescoAnalysis.cs:line 289

Glad for any help..Thanks

Was it helpful?

Solution

You should be aware of using CMIS requires enabling Basic Authentication for your web application to avoid Unauthorized exception.

For more details, check CMIS Prerequisites In SharePoint 2016


Solution

You should Enable Basic Authentication to your Web Application at Claims Authentication Types by doing the following:

  • Open Central Administration > Application Management > Manage web application.

  • Click on your web application, from the above ribbon, select Authentication Provider.

  • Check Basic authentication (credentials are sent in clear text)

For more details, check Configure CMIS In SharePoint 2016

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top