I am trying to update a JIRA plugin that used to fetch and display a users email address. The user.getEmail method was depreciated and referred to user.getEmailAddress which has now been depreciated, but this is where the trail has gone cold for me. Any suggestions?
String |
getEmail() Deprecated. Please use getEmailAddress() . |
String |
|
Community moderators have prevented the ability to post new answers.
Add SAL component to your atlassian-plugin.xml.
<component-import name="SAL User Manager" key="userManager" interface="com.atlassian.sal.api.user.UserManager"/>
Now in the code this should do it
import com.atlassian.sal.api.user.UserManager; import com.atlassian.sal.api.user.UserProfile; public class MyClass { private UserManager userManager; public void setUserManager(UserManager userManager) { this.userManager = userManager; } public void testMethod() { String username = userManager.getRemoteUsername(); UserProfile up = userManager.getUserProfile(username); String email = up.getEmail(); } }
Hi Jangid,
I had hoped to test your solution but I have been sidelined with other work. I am going to mark your answer as correct, it looks pretty solid to me.
Thanks for your input, I was completely stumped.
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.