get-mgsite returning null value for lastModifiedDateTime #2775
Unanswered
LewisIWhyte
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm working on a script to return a list of SharePoint sites and when they were last used, unfortunately it is returning a null value for lastModifiedDateTime.
Unsure if this is a bug or an issue with the code:
#Grab the data
$MSGUser = get-mgsite -Property "DisplayName, siteCollection, webUrl, lastModifiedDateTime"
$SPDomain = "domain.sharepoint.com"
#Filter the Azure information
$FilteredUsers = $MSGUser | where {$_.siteCollection.hostname -EQ $SPDomain}
ForEach($FilterUser in $FilteredUsers){
$MGTable = [PSCustomObject] @{
"Site Name" = $FilterUser.DisplayName
"URL" = $FilterUser.webUrl
"Last Time Used" = $FilterUser.lastModifiedDateTime
}
Write-Output $MGTable
}
Beta Was this translation helpful? Give feedback.
All reactions