gpt4 book ai didi

java - CmisUnauthorizedException : Unauthorized - error using Apache Chemistry library interfacing to Sharepoint 2013

转载 作者:太空宇宙 更新时间:2023-11-04 14:40:44 25 4
gpt4 key购买 nike

我在使用 Apache Chemistry 库通过 CMIS 连接到 Sharepoint 2013 时遇到问题。

我收到未经授权的错误,但我使用的凭据 (U/P) 是正确的。

我用它登录 Sharepoint Online,因此它应该可以处理我的代码。

希望有人能帮我解决这个问题。谢谢!

请参阅下面我用来创建 Sharepoint session 的代码:

public Session fillParams()    {//define some values for the connection string
String rest_base = "http://<server>/sites/_api/web/";
String repository_id = "c013ab76-4821-489f-9a1c-1d43bfce1c32";
String atompub_url = rest_base + "/" + repository_id + "";
String username ="notTobeShown";
String password = "notTobeShown";
SessionFactory factory = SessionFactoryImpl.newInstance();
Map<String, String> parameter = new HashMap<String,String>();

parameter.put(SessionParameter.ATOMPUB_URL, rest_base);
parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
parameter.put(SessionParameter.AUTH_HTTP_BASIC, "true");
parameter.put(SessionParameter.USER, username);
parameter.put(SessionParameter.PASSWORD, password);
System.out.println("Pfft");
List<Repository> repositories = factory.getRepositories(parameter);
System.out.println("repositories: " + repositories.size());
return repositories.get(0).createSession();
}

有关完整的异常堆栈跟踪,请参见下文:

Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException: Unauthorized at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:466) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.read(AbstractAtomPubService.java:619) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getRepositoriesInternal(AbstractAtomPubService.java:782) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:65) at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:88) at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:133) at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:111) at sample.CMISConnect.fillParams(CMISConnect.java:35) at sample.CMISConnect.main(CMISConnect.java:42)

最佳答案

单击网站页面右上角的齿轮图标。转到“网站设置”->“网站操作”下的管理网站功能。在这个'CMIS生产者'必须是活跃的。

关于java - CmisUnauthorizedException : Unauthorized - error using Apache Chemistry library interfacing to Sharepoint 2013,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24954600/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com