Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Get Space Name from Space Key

Jamie Randall June 4, 2014

Forgive me as I am new to writing macros in Confluence... Is it possible to get the name of a space by providing the space key? i.e.

#set ( $spaceKey = 'SUBSPACEKEY' )

#set ( $spaceName = $space.getName($spaceKey) )

I understand I can get the "current" space name from $space.getName() however this will not work for me as I have a user macro that will be pointing at a different space...

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 4, 2014

Try:

$spaceManager.getSpace($spaceKey).getName()

Infornation about what variables are available in your velocity template are available here: https://developer.atlassian.com/display/CONFDEV/Confluence+Objects+Accessible+From+Velocity<br< a="">>

Jamie Randall June 4, 2014

That worked! Thank you for that and the additional info!

1 vote
Pavel Potcheptsov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2017
$space.getName()
TAGS
AUG Leaders

Atlassian Community Events