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

Confluence groovy setEmail()

Lukas K. February 7, 2019

Hi,

I have problem with setting new email to user in Confluence by groovy.

Documentation says that class com.atlassian.user.User have method setEmail(String email), but Script Console in Confluence says the opposite - Confluence uses implementation class com.atlassian.confluence.user.ConfluenceUserImpl and this class has no method for set email.

 

This is my code:

import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.user.UserManager
import com.atlassian.user.User

def userManager = ComponentLocator.getComponent(UserManager)

User user = userManager.getUser("user001");
user.setEmail("new@email.cz");

 

Have you idea how can I set the new email by groovy (script runner) in Confluence?

 

Thanks

Lukas

 

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Anton Kulikov April 15, 2021

maybe you should try this to get user

def users = userManager.users.find{it.getName() == "username"}

 

TAGS
AUG Leaders

Atlassian Community Events