01-05-2022 05:15 AM
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"?
01-05-2022 10:25 AM
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/
01-05-2022 10:25 AM
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/
02-02-2022 05:42 AM
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
Explore our Alfresco products with the links below. Use labels to filter content by product module.