Dear All
I’m really sorry to re-open this post.
However I still get the issues described here and for example here:
Even if I use the new Set-UDElement Function described above I get
“Cannot read property ‘version’ of undefined”.
From what I learned searching the forum this issues should have been resolved.
The question is therefore: What am I doing wrong?
For your Information, this is what I’m trying to do:
function get-RemoteUsers {
try `
{
Get-ADUser -ea Stop -SearchBase "OU=MyOU,OU=MyOrganisation,DC=demolab,DC=local" -SearchScope OneLevel -Properties Description, Company, mail, manager, accountExpires -LDAPFilter "(&(&(&(&(objectCategory=person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2)))))" | Select-Object `
@{ Label = "Name"; Expression = { ($_.Name) } },
@{ Label = "Username"; Expression = { ($_.saMAccountName) } },
@{ Label = "EMail"; Expression = { ($_.mail) } },
@{ Label = "Company"; Expression = { ($_.company) } },
@{ Label = "Description"; Expression = { ($_.description) } },
@{ Label = "Responsible"; Expression = {
(Get-ADUser -Identity $_.manager).name
} },
@{ Label = "Expiration Date"; Expression = { `
if ($_.accountExpires -eq 0)
{
"Never"
}
elseif ($_.accountExpires -eq 9223372036854775807)
{
"Never"
}
else
{
$expirationDate = [datetime]::FromFileTime($_.accountExpires)
$expirationDate.AddDays(-1).ToString("dd.MM.yyyy")
#([datetime]::FromFileTime($_.accountExpires).toString("dd.MM.yyyy"))
# $expirationDate.toString("dd.MM.yyyy")
}
}
}
}
catch
{
}
The UDTable gets initially created like that:
New-UDCard -Title “Query Results” -Content {
# New-UDTable -Id 'extuser_table' -Data $Data -Columns $Columns -Title 'External Users' -ShowSearch -ShowSort -PageSize 20 -ShowPagination -ShowSelection -Dense -OnRowSelection {
$dataquery = get-RemoteUsers
New-UDTable -Id 'extuser_table' -Data $dataquery -Columns $Columns -ShowSort -PageSize 20 -ShowPagination -ShowSelection -Dense -OnRowSelection {
$Item = $EventData
# Show-UDToast -Message "$($Item).name"
}
But then when I try to update the table using a simple button like that it doesn’t work:
New-UDButton -Text "GET Rows" -OnClick {
Set-UDElement -Id 'extuser_table' -Properties @{
Data = get-RemoteUsers
}
}
Thanks a lot for your much appreciated help!
Best regards,
Don