Skip to content

Script did not return all messages for some users #15

@QuestNut

Description

@QuestNut

This script is great, thank you for the hard work and sharing. I am by no means very good with PowerShell. But after noticing the script was not pulling all messages for users, had one of my colleague developers review. I will probably explain this incorrectly, but if a value of 0 messages is returned, script should not terminate, but should look for next link, as one odata link may have 0 results but the next may not. I believe that is how my colleague described.

This was the addition my colleague made to line 83 of the script:

-or (-not [string]::IsNullOrEmpty($response.'@odata.nextLink'))

So, line 83 now looks like this in full:

if (($response.'@odata.count' -gt 0) -or (-not [string]::IsNullOrEmpty($response.'@odata.nextLink'))) {

I just wanted to share in case this helps, this allowed me to capture all messages for users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions