This is for the dbatools
discord thread at: https://discord.com/channels/180528040881815552/800214699463409704/1217419649793130649
class RawIncident {
[int]$IncidentId
[string]$MailId
[string]$Status
[string]$Priority
[string]$ConfigName
[string]$SenderAddress
[string]$SenderName
[string]$MachineName
[string]$InstanceName
[DateTime]$RecievedDate
[DateTime]$SentDate
[string]$BodyHTML
[string]$ObjectCategory
[string]$ObjectName
[string]$RawSubject
[string]$RawContent
[string]$RawContentType
}
How do you use it? You have a bunch of options
Using the implicit hashtable constructor.
[RawIncident]@{
IncidentId = 234
BodyHTML = '<h1>hi world</h1>'
}
That default constructor is shorthand for manually assigning properties like this:
$record = [RawIncident]::new()
$record.Incident = 234
$record.BodyHTML = '<h1>hi world</h1>'
For default values, you can use either of these.
[RawIncident]@{}
[RawIncident]::new()
Some of those formats will change if you write your own constructor.