Closed JohnLBevan closed 4 years ago
when writing the documentation for the fix of #404 , I noticed that the email address might not be returned by the server depending on the privacy settings. You are absolutely right with your findings. Thank you for reporting this. but unfortunately, I can't think of a way how the module could work around this.
Description
Running
Get-JiraUser -Username ''
(or variants) returns users successfully, but theirEmailAddress
property is blank.This seems to be down to a change in the API; but reporting here as the field is returned, so people would expect it to be populated. I'm logging this more for the benefit of others encountering this issue than for a bugfix in this module, as I don't think it's fixable within this module, but is rather a restriction of the API.
The reason we see the EmailAddress property is because it's assigned here: https://github.com/AtlassianPS/JiraPS/blob/0c081ad647f1d2102699229990d54c914b3579df/JiraPS/Private/ConvertTo-JiraUser.ps1#L18 The reason this is blank is because the API no longer populated an EmailAddress field (e.g. going to https://mytenant.atlassian.net/rest/api/latest/user?maxResults=1&username=ExactExampleUsername does not include a mail address).
Atlassian have documented removing this field here: https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/
Steps To Reproduce
Get-JiraUser -Username '' | Select -First 1 *
Expected behavior
The user's email address should be populated.
Your Environment
Possible Solution
Navigate to: https://myTenant.atlassian.net/secure/admin/ViewApplicationProperties.jspa If you see:
User email visibility
set toShow to logged in users only
, that is the cause.In theory, to resolve, click
Edit Settings
(top right) then changeUser Email Visibility
toPublic
. Sadly initial tests have shown that info still doesn't come through the API / it seems this issue was discovered and reported ~2 years ago: https://community.atlassian.com/t5/Jira-questions/Get-emailAddress-of-user-with-REST-API/qaq-p/718538Note: I'm not sure whether JiraPS could show a warning explaining why this information is not shown when it's not retrieved?
Alternatively happy for this to be closed as it's not a JiraPS bug; just wanted to ensure the ticket's here to help others hitting this issue in future.