5.5. Modifying existing messages
Now that we have created some messages, it is worthwhile to see what we can do with them afterwards.
5.5.1. Reactivating an existing IDERI note message
Sometimes you already have an existing message with content to be reused and
you don’t want a new message to be created every time you want to inform the
message’s recipients. Instead, you might want to reactivate the IDERI note message by changing its
start and end time. For this purpose, we can use the Enable-iNoteMessage
CmdLet or
its alias Restart-iNoteMessageRevision
.
PS> Enable-iNoteMessage -Index 4 -EndTime (Get-Date).AddHours(1) -Force
The command in the example above creates a new revision of the IDERI note message with index 4 and sets its start time to the current time. Additionally we defined a new end time of one hour from now. The ‘-Force’ parameter will execute the command without prompting for confirmation.
5.5.2. Cancelling an existing IDERI note message
In order to cancel an existing message, we can use the
Disable-iNoteMessage
CmdLet or its alias Stop-iNoteMessage
.
PS> Disable-iNoteMessage -Index 4 -Force
The command in the example above creates a new message revision of the IDERI note message with index 4 and sets its start and end time to the current time so the message is not valid anymore and will vanish from the recipients’ desktops.
5.5.3. Creating a new revision of an existing IDERI note message
If we want to change an existing IDERI note message entirely by assigning a new
text, start and end time and some other properties, we can use the
Set-iNoteMessage
CmdLet. The process is pretty similar to the one described in
chapter 5.4.2: We first need to
define a new message object that has all the desired properties followed by the
execution of Set-iNoteMessage
in order to create the new IDERI note message
revision.
PS> $MsgObj = Get-iNoteMessage -Index 2
PS> $MsgObj.Text = "My changed text for the new revision."
PS> $MsgObj.StartTime = (Get-Date)
PS> $MsgObj.EndTime = (Get-Date).AddHours(2)
PS> $MsgObj.NotifyReceive = $true
PS> $MsgObj.LinkTarget = "https://www.iderinote.com"
PS> $MsgObj.LinkText = "A link to iderinote.com"
PS>
PS> Set-iNoteMessage -MessageObject $MsgObj -Index 4
Index : 4
RevisionIndex : 2
Text : My changed text for the new revision.
Priority : Information
StartTime : 8/3/2023 8:38:11 AM
EndTime : 8/3/2023 10:38:11 AM
LinkText : A link to iderinote.com
LinkTarget : https://www.iderinote.com
ShowLinkMaximized : False
Recipient : {NOTE\eva.smith, NOTE\albert.tross, NOTE\Arno.Nym}
Exclude : {}
AddressingMode : UserOnly
ShowPopup : True
ShowTicker : False
ShowFullscreen : False
ShowFullscreenAndLock : False
NotifyReceive : True
NotifyAcknowledge : False
ShowOnWinLogon : False
ShowOnWinLogonOnly : False
HomeOfficeUsersOnly : False
HomeOfficeUsersExclude : False
RevisionCreated : 8/3/2023 8:38:24 AM
RevisionUpdater : NOTE\adam.sam
In the example above we query the
message with index 2 from the server first and save it to an object variable
named $MsgObj. Afterwards we modify some of its properties like the text,
start and end time, link and NotifyReceive. All the other properties from the
old message will be retained.
Next we execute Set-iNoteMessage
and specify our
object as a parameter. We also provide the CmdLet with the index of the message we want
to change. The newly created IDERI note message revision will be returned as the
result of this operation.