Hi,
ist jetzt zwar nicht für Views, sondern Agenten...
Alternativ: Mit dem R6 Designer Client kann man Agenten auch nachträglich ändern.
Agent 1: going from PRIVATE to SHARED:
======================================
Sub Initialize
' ++++++++++++++++++++++++++++++++++++++++++++++++++++++
' + Agent "Change Agent to SHARED"
' + sub Initialize
' + This agent changes another agent within the same database
' + from PRIVATE to SHARED;
' + Since there is no other way (at least none that I know of) it loops
' + through all possible Note IDs from 0x0001 to 0xFFFF; if the agent
' + isn't found within this range and misspelling can be excluded as a
' + reason the range has to be extended (resulting in longer
' + processing time !).
' + Once the agent to be changed is found the design note fields
' + "$AssistFlags" and "$Flags" are manipulated:
' + the first field controls the "Shared Agent" checkbox, the other is
' + a combination of various design note properties; both have to be
' + manipulated at the same time;
' + if "$AssistFlags" contains a "P" the checkbox is unmarked;
' + if "$Flags" contains a "V" the design note is marked as being
' + PRIVATE;
' +
' + USE THIS AGENT AT YOUR OWN RISK ! Be sure to make a
' + backup copy of the agent before manipulating it !!
' ++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dim sn As New NotesSession
Dim thisdb As NotesDatabase
Dim coll As NotesDocumentCollection
Dim doc As NotesDocument
Dim agnt As NotesAgent
Dim strTitle As String
Dim strFlag As String
Dim strL As String
Dim strR As String
Dim strNID As String
Dim intSuccess As Integer
Dim intPos As Integer
Dim lngCnt As Long
intSuccess = False ' preset the SUCCESS flag
Set thisdb = sn.CurrentDatabase
strTitle = Ucase(Inputbox("Enter the agent's title: ", "CHANGE AGENT FLAGS"))
' looping Note IDs 0001 to FFFF
For lngCnt = 1 To 65535
strNID = Hex (lngCnt)
Set doc = thisdb.GetDocumentByID (strNID)
' is there a document with this Note ID ?
If Not doc Is Nothing Then
' if doc has an item by this name it must be an agent's design note
If doc.HasItem ("$AssistFlags") Then
' does the design note belong to our agent ?
If Ucase(doc.GetItemValue("$TITLE") (0)) = strTitle Then
' a "P" in the $AssistFlags string unchecks the "SHARED" checkbox in the agent designer
strFlag = doc.GetItemValue("$AssistFlags") (0)
intPos = Instr(strFlag, "P")
strL = Left(strFlag, intPos - 1)
strR = Mid(strFlag, intPos + 1)
Call doc.ReplaceItemValue("$AssistFlags", strL & strR)
' a "V" in the $Flags string marks the agent as being PRIVATE
strFlag = doc.GetItemValue("$Flags") (0)
intPos = Instr(strFlag, "V")
strL = Left(strFlag, intPos - 1)
strR = Mid(strFlag, intPos + 1)
Call doc.ReplaceItemValue("$Flags", strL & strR)
Call doc.Save (True, True)
' set the SUCCESS flag for a final message
intSuccess = True
Exit For ' no further looping necessary
End If ' UCASE($TITLE)...
End If ' HasItem($AssistFlags)
End If ' not doc is nothing
Next
If intSuccess Then
Msgbox "The agent " & strTitle & " is now marked as 'Shared'. " &_
"The change will be visible after closing and re-opening the database", _
64, "AGENT FLAGS CHANGED"
Else
Msgbox "An agent named " & strTitle & " could not be found", 64, "AGENT FLAGS NOT CHANGED"
End If
End Sub
=======================================
Agent 2: going from SHARED to PRIVATE:
=======================================
Sub Initialize
' + Agent "Change Agent to PRIVATE"
' + sub Initialize
' + This agent changes another agent within the same database
' + from SHARED to PRIVATE;
' + Since there is no other way (at least none that I know of) it loops
' + through all possible Note IDs from 0x0001 to 0xFFFF; if the agent
' + isn't found within this range and misspelling can be excluded as a
' + reason the range has to be extended (resulting in longer
' + processing time !).
' + Once the agent to be changed is found the design note fields
' + "$AssistFlags" and "$Flags" are manipulated:
' + the first field controls the "Shared Agent" checkbox, the other is
' + a combination of various design note properties; both have to be
' + manipulated at the same time;
' + if "$AssistFlags" contains a "P" the checkbox is unmarked;
' + if "$Flags" contains a "V" the design note is marked as being
' + PRIVATE;
' + the person performing this manipulation wil be the new owner of
' + the now private agent
' +
' + USE THIS AGENT AT YOUR OWN RISK ! Be sure to make a
' + backup copy of the agent before manipulating it !!
' ++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dim sn As New NotesSession
Dim thisdb As NotesDatabase
Dim coll As NotesDocumentCollection
Dim doc As NotesDocument
Dim agnt As NotesAgent
Dim strTitle As String
Dim strFlag As String
Dim strL As String
Dim strR As String
Dim strNID As String
Dim intSuccess As Integer
Dim intPos As Integer
Dim lngCnt As Long
intSuccess = False ' preset the SUCCESS flag
Set thisdb = sn.CurrentDatabase
strTitle = Ucase(Inputbox("Enter the agent's title: ", "CHANGE AGENT FLAGS"))
' looping Note IDs 0001 to FFFF
For lngCnt = 1 To 65535
strNID = Hex (lngCnt)
Set doc = thisdb.GetDocumentByID (strNID)
' is there a document with this Note ID ?
If Not doc Is Nothing Then
' if doc has an item "$AssistFlags" it must be an agent's design note
If doc.HasItem ("$AssistFlags") Then
' does the design note belong to our agent ?
If Ucase(doc.GetItemValue("$TITLE") (0)) = strTitle Then
' a "P" in the $AssistFlags string unchecks the "SHARED" checkbox in the agent designer
strFlag = doc.GetItemValue("$AssistFlags") (0) & "P"
Call doc.ReplaceItemValue("$AssistFlags", strFlag)
' a "V" in the $Flags string marks the agent as being PRIVATE;
' the person running this agent will become its owner
strFlag = doc.GetItemValue("$Flags") (0)
intPos = Instr(strFlag, "f")
strL = Left(strFlag, intPos)
strR = Mid(strFlag, intPos + 1)
Call doc.ReplaceItemValue("$Flags", strL & "V" & strR)
Call doc.Save (True, True)
' set the SUCCESS flag for a final message
intSuccess = True
Exit For ' no further looping necessary
End If ' UCASE($TITLE)...
End If ' HasItem($AssistFlags)
End If ' not doc is nothing
Next
If intSuccess Then
Msgbox "The agent " & strTitle & " is now marked as 'PRIVATE'. " &_
"The change will be visible after closing and re-opening the database", _
64, "AGENT FLAGS CHANGED"
Else
Msgbox "An agent named " & strTitle & " could not be found", 64, "AGENT FLAGS NOT CHANGED"
End If
End Sub