Connecting via CMIS (dotCMIS) to SP2010: exception

2019-03-04 14:45发布

Im using dotCMIS and would like to do a simple connect to my SP2010 server. Im trying to do this with C# like here http://chemistry.apache.org/dotnet/getting-started-with-dotcmis.html in the first part

So I have something like this:

    Dictionary<string, string> parameters = new Dictionary<string, string>();
    parameters[SessionParameter.BindingType] = BindingType.AtomPub;
    parameters[SessionParameter.AtomPubUrl] = "http://mysharepoint";
    parameters[SessionParameter.User] = "SPAdmin";
    parameters[SessionParameter.Password] = "1234sharepoint";

    SessionFactory factory = SessionFactory.NewInstance();
    ISession session = factory.GetRepositories(parameters)[0].CreateSession(); //exception unathorized

But I get always the exception: DotCMIS.Expcetions.CmisRunterimException: Unathorised

Any ideas? Via browser I can login to the site with the same user/pass, so thats might be not the problem. At first I tought its because of the NTLM problem (https://issues.apache.org/jira/browse/CMIS-531) but even if Im using parameters[SessionParameter.AuthenticationProviderClass] = "DotCMIS.Binding.NtlmAuthenticationProvider"; its the same exception. And well... this exception is not really helping me. I wish I could get more information - maybe there is a better way? What else could I try? Thank you!

PS: And yes, before I started with dotCMIS I did install and configure the MS CMIS connector: http://technet.microsoft.com/en-us/library/ff934619.aspx

2条回答
forever°为你锁心
2楼-- · 2019-03-04 15:06

Yes the AtomPubUrl was wrong.

For sharepoint its not enough to post the default sp url (http://mysharepoint) or the url to the cmis lib (http://mysharepoint/cmis) I need to point to the repository id, somehow the sp endpoint for CMIS is:

http://mysharepoint/_vti_bin/<myLib4CMIS>/<repID>?getRepositoryInfo

http://technet.microsoft.com/en-us/library/ff934619.aspx

Somehow it was confusing, but its working :) dotCMIS is really nice.

查看更多
劫难
3楼-- · 2019-03-04 15:28

Your AtomPubUrl looks suspicious. I can't tell if that's a placeholder you've added to mask the real URL or if that's the actual URL you are using. If it is the actual URL it looks like it is missing the path to the AtomPub service document. To tell if that's the case, you should be able to invoke the URL, log in, and get a bunch of XML back, which is the CMIS service descriptor. If instead you are getting a user-facing page full of HTML, you are using the wrong URL.

For example, in Alfresco, users log in to /share, but the AtomPub binding is at /alfresco/cmisatom.

查看更多
登录 后发表回答