Create a Group based on a field (Company Name) in a Person Document


%REM
    Agent AdminP
    Created Apr 4, 2022
    Description: set to adminp to update group
%END REM
Option Public
Option Declare ' always use Option Declare 
Sub Initialize 
    Dim session As New NotesSession 
    Dim adminp As NotesAdministrationProcess 
    Dim db As NotesDatabase 
    Dim coll As NotesDocumentCollection 
    Dim docRequest As NotesDocument 
    Dim strID, CompanyName As String 
    Dim FullName(0) As String 
    Set db = session.CurrentDatabase 
    Set coll = db.UnprocessedDocuments 
    Set docRequest = coll.GetFirstDocument( ) 
    
    Do Until docRequest Is Nothing 
        
        FullName(0) = docRequest.FullName(0)
        
        CompanyName = "x" & docRequest.CompanyName(0)  ' group name as x + companyname
        
        Set adminp = session.CreateAdministrationProcess("SERVER/ORG") 
        strID = adminp.AddGroupMembers(CompanyName,  FullName)
        If strID = "" Then
            MsgBox {Unable to create adminp request "Add or Modify Group"}, 0, {adminp failure}
        End If 
        session.UpdateProcessedDoc docRequest 
        Set docRequest = coll.GetNextDocument(docRequest)
    Loop 
    
End Sub
All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.
No comments yetLogin first to comment...