You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi,
I want to write a user macro to get a public list of all spaces, not only the spaces the current user has access to. The official documentation mentions the $spaceManager (https://developer.atlassian.com/server/confluence/confluence-objects-accessible-from-velocity/) but the requried method getAllSpaces() is marked as deprecated (https://docs.atlassian.com/ConfluenceServer/javadoc/7.4.0/com/atlassian/confluence/spaces/SpaceManager.html).
Is there another way to get a list of all spaces without running into trouble in near future? There is a hint in the documentation saying "since 7.3.0, use SpaceService.find(Expansion...) in plugins and SpaceManagerInternal in core where applicable". I tried but I can't get it up and running.
Hi there, did you manage to find a way to work with the SpaceService.find() method in a user macro? I am running into the same problem...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
int start = 0;
PageResponse<Space> pageResponse;
do {
pageResponse = spaceService.find().fetchMany(new SimplePageRequest(start, start + MAX_RESULTS));
for (Space space : pageResponse.getResults()) {
// do stuff
}
start += MAX_RESULTS;
} while (pageResponse.hasMore());
MAX_RESULTS HAS TO be 500 because that's the limit for fetchMany. Where did I read that? Nowhere, it isn't documented and you have to guess it (fortunately I did it before production).
This method sucks, getAllSpaces() is much better, and to make it even worse, one method returns 1433 and the other 1423 for which should give the same results.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.