12Knocksinna / Office365itpros

Office 365 for IT Pros PowerShell examples
MIT License
1.3k stars 570 forks source link

TeamsGroupsActivityReport.ps1 -> $LastConversationDate is null #15

Closed PorreKaj closed 4 years ago

PorreKaj commented 4 years ago

$LastConversationDate is never made/populated with data, and as such will always result in "No items found"

adding $LastConversationDate = $data.NewestItemReceivedDate before Line 110 should fix this.

Thanks.

12Knocksinna commented 4 years ago

The $LastConversation variable is set in:

If ([string]::IsNullOrEmpty($Data.NewestItemReceivedDate)) {$LastConversation = "No items found"}
Else {$LastConversation = Get-Date ($Data.NewestItemReceivedDate) -Format g }

If nothing is found, we set the "No items found" string else we populate the variable with the newest item received date.

The information is definitely populated:

GroupName : Exchange's Grumpy Old People ManagedBy : Tony Redmond Members : 35 ExternalGuests : 31 Description : Exchange Grumpy Old Men (and Women too)... Originally an Office 365 Group and now maybe a team too... MailboxStatus : Normal TeamEnabled : True LastChat : 03/09/2020 23:19 NumberChats : 17589 LastConversation : 03/09/2020 23:19 NumberConversations : 11104 SPOActivity : Document library in use SPOStorageGB : 1.07 SPOStatus : Normal WhenCreated : 29/09/2016 19:37 DaysOld : 1439 NumberWarnings : 0 Status : Pass