cancel
Showing results for 
Search instead for 
Did you mean: 

Adding metadata to an existing folder

msmith
Champ in-the-making
Champ in-the-making
Hello,

If I have many existing folders (of the plain cm:folder type) and I want to add meta-data to them later on, is there anyway I can do that without recreating the folders as a custom type that has the metadata fields?
3 REPLIES 3

jm_pascal
Star Contributor
Star Contributor
Hello,
Maybe You can add aspect. http://wiki.alfresco.com/wiki/Aspect

You can automatize adding aspect with Alfresco Javascript API. http://wiki.alfresco.com/wiki/JavaScript_API

Example :
Add Aspects
Adding several aspects to a document:var props = new Array(1);props["cm:template"] = document.nodeRef;document.addAspect("cm:templatable", props);props = new Array(1);props["cm:lockIsDeep"] = true;document.addAspect("cm:lockable", props);props = new Array(1);props["cm:hits"] = 1;document.addAspect("cm:countable", props);‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Hope it helps you

msmith
Champ in-the-making
Champ in-the-making
Hi JM,

Is it possible to add an aspect to a folder? I was under the impression that you could not.

jm_pascal
Star Contributor
Star Contributor
Hey,

You can add what you want where you want if you have the right  to modify the node.

Example :
var testingFolder = companyhome.childByNamePath("Test");props = new Array(1);props["cm:lockIsDeep"] = true;testingFolder.addAspect("cm:lockable", props);props = new Array(1);props["cm:hits"] = 1;testingFolder.addAspect("cm:countable", props);‍‍‍‍‍‍‍‍‍

This code add 2 properties (cm:lockIsDeep and cm:hits) to the cm:folder Test
BUT
you can't see this modification except in NodeBrowser!

Example
Node IdentifierPrimary Path:   /{http://www.alfresco.org/model/application/1.0}company_home/{http://www.alfresco.org/model/content/1....Reference:   workspace://SpacesStore/b7ecc8b1-5edb-11dd-afdd-79a008cbb404Type:   {http://www.alfresco.org/model/content/1.0}folderParent:    workspace://SpacesStore/4cdcf19f-6fee-11dc-8621-f597096320a0PropertiesName   Value   Property Type   Value Type   Residual{http://www.alfresco.org/model/content/1.0}description      {http://www.alfresco.org/model/dictionary/1.0}mltext      false{http://www.alfresco.org/model/application/1.0}icon   space-icon-default   {http://www.alfresco.org/model/dictionary/1.0}text      false{http://www.alfresco.org/model/system/1.0}node-uuid   b7ecc8b1-5edb-11dd-afdd-79a008cbb404   {http://www.alfresco.org/model/dictionary/1.0}text      false{http://www.alfresco.org/model/system/1.0}node-dbid   577   {http://www.alfresco.org/model/dictionary/1.0}long      false{http://www.alfresco.org/model/content/1.0}title      {http://www.alfresco.org/model/dictionary/1.0}mltext      false{http://www.alfresco.org/model/content/1.0}lockIsDeep   true   {http://www.alfresco.org/model/dictionary/1.0}boolean      false{http://www.alfresco.org/model/content/1.0}created   Thu Jul 31 10:36:06 CEST 2008   {http://www.alfresco.org/model/dictionary/1.0}datetime      false{http://www.alfresco.org/model/content/1.0}modifier   admin   {http://www.alfresco.org/model/dictionary/1.0}text      false{http://www.alfresco.org/model/content/1.0}modified   Thu Jul 31 10:41:26 CEST 2008   {http://www.alfresco.org/model/dictionary/1.0}datetime      false{http://www.alfresco.org/model/content/1.0}creator   admin   {http://www.alfresco.org/model/dictionary/1.0}text      false{http://www.alfresco.org/model/content/1.0}hits   1   {http://www.alfresco.org/model/dictionary/1.0}int      false{http://www.alfresco.org/model/system/1.0}store-protocol   workspace   {http://www.alfresco.org/model/dictionary/1.0}text      false{http://www.alfresco.org/model/content/1.0}name   Test   {http://www.alfresco.org/model/dictionary/1.0}text      false{http://www.alfresco.org/model/system/1.0}store-identifier   SpacesStore   {http://www.alfresco.org/model/dictionary/1.0}text      falseAspects{http://www.alfresco.org/model/content/1.0}lockable{http://www.alfresco.org/model/content/1.0}auditable{http://www.alfresco.org/model/application/1.0}uifacets{http://www.alfresco.org/model/system/1.0}referenceable{http://www.alfresco.org/model/content/1.0}countable‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍


You have to modify the screen if you want to look this new properties.
For more information : http://wiki.alfresco.com/wiki/Displaying_Custom_Metadata