微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

c# – 使用DotCMIS for Alfresco时出现错误“属性’cm:标题’不存在”

@H_502_4@ 我通过dotCMIS与使用Visual Studio 2010 C#via的本地Alfresco-Server建立了会话

Dictionary<string,string> parameters = new Dictionary<string,string>();    
parameters[DotCMIS.SessionParameter.BindingType] = BindingType.Atompub;      
parameters[DotCMIS.SessionParameter.AtompubUrl] = "http://127.0.0.1:8888/alfresco/api/-default-/public/cmis/versions/1.1/atom";           
parameters[DotCMIS.SessionParameter.User] = "admin";
parameters[DotCMIS.SessionParameter.Password] = "admin";           
SessionFactory factory = SessionFactory.NewInstance();    
IList<IRepository> repos = factory.GetRepositories(parameters);
ISession session = repos.ElementAt(0).CreateSession();

但是当我试图获得一个文件夹时

IFolder root = session.GetRootFolder();

或运行查询

string queryGetDoc = "SELECT * FROM cmis:document WHERE cmis:name='Bug101.png'";
IItemEnumerable<IQueryResult> docResults = session.Query(queryGetDoc,false);
IQueryResult docHit = docResults.FirstOrDefault();
string docId = docHit["cmis:objectId"].FirstValue.ToString();

IDocument document = session.Getobject(docId) as IDocument;

IList<IProperty> listofProperties = document.Properties;

foreach (IProperty p in listofProperties)
{
    Console.WriteLine(p.QueryName);
}

我收到一条错误消息:

DotCMIS.Exceptions.CmisRuntimeException: Property ‘cm:title’ doesn’t exist!
bei DotCMIS.Client.Impl.ObjectFactory.ConvertProperty(IObjectType objectType,IPropertyData pd)
bei DotCMIS.Client.Impl.ObjectFactory.ConvertProperties(IObjectType objectType,IProperties properties)
bei DotCMIS.Client.Impl.AbstractCmisObject.Initialize(ISession session,IObjectType objectType,IObjectData objectData,IOperationContext context)
bei DotCMIS.Client.Impl.Folder..ctor(ISession session,IOperationContext context)
bei DotCMIS.Client.Impl.ObjectFactory.ConvertObject(IObjectData objectData,IOperationContext context)
bei DotCMIS.Client.Impl.Session.Getobject(String objectId,IOperationContext context)
bei DotCMIS.Client.Impl.Session.Getobject(IObjectId objectId,IOperationContext context)
bei DotCMIS.Client.Impl.Session.GetRootFolder(IOperationContext context)
bei DotCMIS.Client.Impl.Session.GetRootFolder()
bei ConsoleApplication3.Program.ConnectingUsingAtompub_CreateFolder()

我可以猜测,我在这里缺少一些基础知识,但我在网上搜索,只找到了https://github.com/wk-j/alfresco-cmis/issues/1.

但是我不知道如何应用它,或者它是否是正确的.

解决方法

正如Gagravarr建议的那样简单:将连接端点更改为CMIS 1.0,查询工作正常.如果我找到一个使用PortCMIS和CMIS 1.1的propper解决方案,我稍后会发布.

parameters[DotCMIS.SessionParameter.AtompubUrl] = "http://127.0.0.1:8888/alfresco/api/-default-/public/cmis/versions/1.0/atom";

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐