hello everyone, and thanks for reading this,
the document Library of one of my sites changed unexpectly to "type: websiteContainer", now it is not accesible anymore from the front-end in share.
is there a way to change it back to "type: cm_folder"?
Solved! Go to Solution.
You can use JSConsole or write a js repository webscript to change the type back to cm:folder. You can use nodeService's setType method to change the type.
These amps works with acs7 if you would like to install and use the JSConsole:
Here is a video on how to use it: https://www.youtube.com/watch?v=c3JIeVY8Nnk
Here is a sample code that can be used to change the type via JSConsole:
var nodeRefStr = 'workspace://SpacesStore/e0df9384-9472-472e-95c0-2e091f452700'; //Node ref of the corrupted folder try { var node=search.findNode(nodeRefStr); logger.log("NodeRef: "+ node.nodeRef+" | Name: "+node.name) var ctxt = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext(); var nodeService = ctxt.getBean('NodeService', org.alfresco.service.cmr.repository.NodeService); var QName = Packages.org.alfresco.service.namespace.QName; var nodeTypeFolder = QName.createQName("{http://www.alfresco.org/model/content/1.0}folder"); nodeService.setType(node.nodeRef, nodeTypeFolder); } catch (ex) { logger.log("Exception occurred: " + ex.message); }
If you prefer to use js repository web script, here are the documentations to start with:
https://docs.alfresco.com/content-services/7.0/tutorial/platform/web-scripts/
https://docs.alfresco.com/content-services/5.2/develop/repo-ext-points/web-scripts/
You can use JSConsole or write a js repository webscript to change the type back to cm:folder. You can use nodeService's setType method to change the type.
These amps works with acs7 if you would like to install and use the JSConsole:
Here is a video on how to use it: https://www.youtube.com/watch?v=c3JIeVY8Nnk
Here is a sample code that can be used to change the type via JSConsole:
var nodeRefStr = 'workspace://SpacesStore/e0df9384-9472-472e-95c0-2e091f452700'; //Node ref of the corrupted folder try { var node=search.findNode(nodeRefStr); logger.log("NodeRef: "+ node.nodeRef+" | Name: "+node.name) var ctxt = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext(); var nodeService = ctxt.getBean('NodeService', org.alfresco.service.cmr.repository.NodeService); var QName = Packages.org.alfresco.service.namespace.QName; var nodeTypeFolder = QName.createQName("{http://www.alfresco.org/model/content/1.0}folder"); nodeService.setType(node.nodeRef, nodeTypeFolder); } catch (ex) { logger.log("Exception occurred: " + ex.message); }
If you prefer to use js repository web script, here are the documentations to start with:
https://docs.alfresco.com/content-services/7.0/tutorial/platform/web-scripts/
https://docs.alfresco.com/content-services/5.2/develop/repo-ext-points/web-scripts/
Namaskaram abhinavmishra14, I have been trying to solve this problem for almost one month and i gave up at some point and this generated a lot of work, and lost time. if you are interested and your current situation allows it, i would like to stay in contact with you for future consultancies. regards. Yohan
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.