Hi fellow devs,
What is the easiest way to create a node in all sites?
I'm aware of how to create nodes:
https://api-explorer.alfresco.com/api-explorer/#!/nodes/createNode
And how to get all sites:
https://api-explorer.alfresco.com/api-explorer/#!/sites/listSites
But a bit lost in what is the best way to connect both in order to create a node for all sites...
Any advice you can give?
Thanks for you time
There is no ootb way to create a node in all available sites in repository at same time.
If the node is meant to be shared, you should created in "Shared Files".
If you still need to create the node in each and every available site, then implement a behavior which listens to node creation event, find the available sites before node creation and then loop through all sites and create the node.
Refer this post for more on implementing behaviors: https://ecmarchitect.com/alfresco-developer-series-tutorials/behaviors/tutorial/tutorial.html
Helpful in getting all sites or getting sites based on current user who is logged in via SiteService:
NodeCreation via node service:
Many thanks for the feedback abhinavmishra14 , currently trying to implement the advised solution.
After it will give my feedback how it was implemented.
In this case the folder is not supposed to be shared so I will focus on the other option.
And also thanks for reminding about the node creation event, it will be quite cool if this can be dynamic, in the sense that once the user creates a new node the folder is there.
Cheers, ARamos
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.