我使用 Visual Studio 2010 C# 通过 dotCMIS 与本地 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”不存在!北 DotCMIS.Client.Impl.ObjectFactory.ConvertProperty(IObjectType objectType, IPropertyData pd) 北 DotCMIS.Client.Impl.ObjectFactory.ConvertProperties(IObjectType objectType, IProperties 属性) 北 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。
我只能猜测,我在这里遗漏了一些基础知识,但我在网上搜索,只找到https://github.com/wk-j/alfresco-cmis/issues/1。
但是我不知道如何应用它,或者它是否是正确的。