Hi,
Is there an automated way to convert private agents to shared agents without doing it one by one…
Thanks!!!
Hi,
Is there an automated way to convert private agents to shared agents without doing it one by one…
Thanks!!!
Subject: Convert private agents to shared agents
If you get at the design note, you should be able to manipulate the fields
$AssistFlags
$Flags
which from my brief experiment, change values when switching the agent from private to public and back.
Private
=====
$AssistFlags: contains the character “P”
$Flags: contains the character “V”
Public
=====
$AssistFlags: does not contain the character “P”
$Flags: does not contain the character "V
Note that case is likely important and position of the character may be as well. There may also be other fields that change and I suggest the best thing to do is to experiment with some test agents in a test database.
Subject: RE: Convert private agents to shared agents
We had a similar need and I have come up with the following code that seems to work for us. If anyone sees anything that could be improved on, please response.
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim nc As NotesNoteCollection
Dim doc As NotesDocument
Dim flagsbefore As String
Dim flagsafter As String
Dim aflagsbefore As String
Dim aflagsafter As String
Dim retval As Variant
Dim nid As String
Dim nextnid As String
Set db = s.CurrentDatabase
Set nc = db.CreateNoteCollection(False)
nc.SelectAgents = True
Call nc.BuildCollection
nid = nc.GetFirstNoteId
For i = 1 To nc.Count
nextid = nc.GetNextNoteId(nid)
Set doc = db.GetDocumentByID(nid)
If Not(doc Is Nothing) Then
’ if $Flags contains a V and $AssistFlags contains a P, then it is a private agent
flagsbefore=doc.GetItemValue("$Flags")(0)
aflagsbefore=doc.GetItemValue("$AssistFlags")(0)
If Instr(flagsbefore,"V")<>0 Then
flagsafter=Replace(flagsbefore,"V","")
aflagsafter=Replace(aflagsbefore,"P","")
'Adding 456789 to the end of $Flags removes it from the menu for versions 4-9
Call doc.ReplaceItemValue("$Flags",flagsafter + "456789")
Call doc.ReplaceItemValue("$AssistFlags",aflagsafter)
Call doc.Save(True,False)
End If
End If
nid = nextid
Next
End Sub
MJ