Skip to content

Commit

Permalink
Merge pull request #1259 from JohnDuprey/dev
Browse files Browse the repository at this point in the history
bugfixes and improvements
  • Loading branch information
JohnDuprey authored Jan 22, 2025
2 parents e7e81b7 + d540698 commit 20eddfd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@ Function Invoke-ListTeamsVoice {
$TenantFilter = $Request.Query.TenantFilter
$tenantid = (Get-Tenants | Where-Object -Property defaultDomainName -EQ $Request.Query.TenantFilter).customerId
try {
$users = (New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users?`$top=999&`$select=id,userPrincipalName,displayname" -tenantid $TenantFilter)
$users = (New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users?`$top=999&`$select=id,userPrincipalName,displayName" -tenantid $TenantFilter)
$skip = 0
$GraphRequest = do {
$data = (New-TeamsAPIGetRequest -uri "https://api.interfaces.records.teams.microsoft.com/Skype.TelephoneNumberMgmt/Tenants/$($Tenantid)/telephone-numbers?skip=$($skip)&locale=en-US&top=999" -tenantid $TenantFilter).TelephoneNumbers | ForEach-Object {
$CompleteRequest = $_ | Select-Object *, 'AssignedTo', 'AcquisitionDate' -ErrorAction SilentlyContinue
$CompleteRequest.AcquisitionDate = $CompleteRequest.AcquisitionDate -split 'T' | Select-Object -First 1
try {
$CompleteRequest = $_ | Select-Object *, 'AssignedTo', 'AcquisitionDate' -ErrorAction SilentlyContinue
$CompleteRequest.AcquisitionDate = $CompleteRequest.AcquisitionDate -split 'T' | Select-Object -First 1
} catch {
$CompleteRequest = $_ | Select-Object *, 'AssignedTo' -ErrorAction SilentlyContinue
}

if ($CompleteRequest.TargetId -eq '00000000-0000-0000-0000-000000000000') {
$CompleteRequest.AssignedTo = 'Unassigned'
} else {
Expand Down
5 changes: 3 additions & 2 deletions Modules/CIPPCore/Public/Entrypoints/Invoke-ListMailboxes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Function Invoke-ListMailboxes {
# Interact with query parameters or the body of the request.
$TenantFilter = $Request.Query.TenantFilter
try {
$Select = 'id,ExchangeGuid,ArchiveGuid,UserPrincipalName,DisplayName,PrimarySMTPAddress,RecipientType,RecipientTypeDetails,EmailAddresses,WhenSoftDeleted,IsInactiveMailbox,ForwardingSmtpAddress,DeliverToMailboxAndForward,ForwardingAddress'
$Select = 'id,ExchangeGuid,ArchiveGuid,UserPrincipalName,DisplayName,PrimarySMTPAddress,RecipientType,RecipientTypeDetails,EmailAddresses,WhenSoftDeleted,IsInactiveMailbox,ForwardingSmtpAddress,DeliverToMailboxAndForward,ForwardingAddress,HiddenFromAddressListsEnabled'
$ExoRequest = @{
tenantid = $TenantFilter
cmdlet = 'Get-Mailbox'
Expand Down Expand Up @@ -67,7 +67,8 @@ Function Invoke-ListMailboxes {
@{ Name = 'AdditionalEmailAddresses'; Expression = { ($_.'EmailAddresses' | Where-Object { $_ -clike 'smtp:*' }).Replace('smtp:', '') -join ', ' } },
@{Name = 'ForwardingSmtpAddress'; Expression = { $_.'ForwardingSmtpAddress' -replace 'smtp:', '' } },
@{Name = 'InternalForwardingAddress'; Expression = { $_.'ForwardingAddress' } },
DeliverToMailboxAndForward
DeliverToMailboxAndForward,
HiddenFromAddressListsEnabled
$StatusCode = [HttpStatusCode]::OK
} catch {
$ErrorMessage = Get-NormalizedError -Message $_.Exception.Message
Expand Down

0 comments on commit 20eddfd

Please sign in to comment.