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...
Hi @[deleted], unfortunately no.
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.