cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the noderef of the sites using sitename?

madhu_sudireddy
Champ on-the-rise
Champ on-the-rise

Is there any web url for this?

1 ACCEPTED ANSWER

vidhipanchal
Star Contributor
Star Contributor

Hi,

You can use the 'SiteService' (Java API) to get noderef and other detalis of site by site's shortName as below: 

SiteInfo site = serviceRegistry.getSiteService().getSite("test");
NodeRef siteNode = site.getNodeRef();

This Link provides more information to you about siteServices.

As well as you can use Javascript API for getting noderef of site

var site = siteService.getSite("jncasr");
var siteNodeRef = site.getNode().getNodeRef();

Regards,

Vidhi

ContCentric

Regards,
Vidhi

View answer in original post

3 REPLIES 3

vidhipanchal
Star Contributor
Star Contributor

Hi,

You can use the 'SiteService' (Java API) to get noderef and other detalis of site by site's shortName as below: 

SiteInfo site = serviceRegistry.getSiteService().getSite("test");
NodeRef siteNode = site.getNodeRef();

This Link provides more information to you about siteServices.

As well as you can use Javascript API for getting noderef of site

var site = siteService.getSite("jncasr");
var siteNodeRef = site.getNode().getNodeRef();

Regards,

Vidhi

ContCentric

Regards,
Vidhi

serviceRegistry does not have "getSiteService()" methode.

can you please let me know exact way ?

ServiceRegistery does have proxy for SiteService. 

https://github.com/Alfresco/alfresco-repository/blob/master/src/main/java/org/alfresco/service/Servi...

Which version of ACS you are on?

You have option to inject siteService via spring bean as well. Example of a bean def:

<bean id="example.action" class="com.example.TestAction" parent="action-executer">
   <constructor-arg ref="SiteService" /> <!-- proxy SiteService -->
</bean>

or

<bean id="example.action" class="com.example.TestAction" parent="action-executer">
<constructor-arg ref="siteService" />
</bean> or <bean id="example.action" class="com.example.TestAction" parent="action-executer"> <property name="siteService" ref="SiteService" /> <!-- proxy SiteService --> </bean>

or

<bean id="example.action" class="com.example.TestAction" parent="action-executer">
<property name="siteService" ref="siteService" />
</bean>
~Abhinav
(ACSCE, AWS SAA, Azure Admin)