I'm having some troubles adding metadata to a document that I am programmatically creating in alfresco.
I'm using dotCMIS library for this.
I have the following code:
IDictionary<string, object> properties = new Dictionary<string, object>();
properties[PropertyIds.Name] = "title.doc";
properties[PropertyIds.ObjectTypeId] = "cmis:document";
ContentStream contentStream = new ContentStream();
contentStream.FileName = "title.doc";
contentStream.MimeType = "application/msword";
contentStream.Length = bytes.Length;
contentStream.Stream = new MemoryStream(bytes);
IDocument doc = folder.CreateDocument(properties, contentStream, null);
So i would also like to set for example, title and description aswell as keywords, references etc ... but I don't know how.
I tried something like that:
properties["cm:title"] = "some title";
OR
properties["cmis:title"] = "some title";
But still no success any idea, how to do it?
Note: i also tried to return all properties from document, but those are not in there, so how do i set them then?
I have this:
string queryGetDoc = "SELECT * FROM cmis:document WHERE cmis:name='document.doc'";
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);
}
And i receive this:
cmis:isLatestMajorVersion
cmis:contentStreamLength
cmis:contentStreamId
cmis:versionSeriesCheckedOutBy
cmis:objectTypeId
cmis:versionSeriesCheckedOutId
cmis:name
cmis:contentStreamMimeType
cmis:versionSeriesId
cmis:creationDate
cmis:changeToken
cmis:versionLabel
cmis:isLatestVersion
cmis:isVersionSeriesCheckedOut
cmis:lastModifiedBy
cmis:createdBy
cmis:checkinComment
cmis:objectId
cmis:isImmutable
cmis:isMajorVersion
cmis:baseTypeId
cmis:contentStreamFileName
cmis:lastModificationDate
Does it mean that other props do not exist on the document? Although in graphical user interface i can set the Title and Description, aswell as keywords and reference ...
What is going on, anyone any idea?