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

Programmatically set user to watch a Confluence page.

Vince Allen April 26, 2015

I would like to programmatically assign a user to watch a page in my Confluence instance using the Java API. I suspect I need to implement the addNotification() method from the DefaultNotificationManager Class. However, when ever I try, I get "Target exception: java.lang.NullPointerException". 

Can someone provide an example? Thx!

 

 

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Lukas Knoch -Rumpelcoders-
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.
April 27, 2015

As page favourites are representet as labels internally, you need to add a personal label like this:

Label favouriteLabel = new Label(LabelManager.FAVOURITE_LABEL, Namespace.PERSONAL, user);
labelManager.addLabel(page, favouriteLabel);

best regards

0 votes
Vince Allen May 1, 2015

Thanks! This is just what I needed.

0 votes
Vince Allen April 27, 2015

Yes, I've seen the tutorial to create a Notifcation plug-in. That's really not what I'm trying to do. I'm using this plug-in to script interactions using Beanshell. I've had success programmatically creating new pages. Now I want to assign users as "Watchers" of those new pages. Since I'm using Beanshell, I was hoping I could find a path forward in the Java docs. Can you point me to a Class that can make a user a Watch a page?

Thanks.

0 votes
Panos
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.
April 26, 2015

Did you read the documentation?

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events