对于Alfresco使用DotCMIS时,错误“属性'cm:标题'不存在'

时间:2016-05-18 12:49:27

标签: c# alfresco dotcmis

我通过dotCMIS与使用Visual Studio 2010 C#的本地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:属性'cm:title'不存在!          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,IObjectType objectType,IObjectData objectData,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

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

1 个答案:

答案 0 :(得分:0)

正如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";