Copy Code
|
|
---|---|
Public Sub AddSiteUser() ' Add a site user Dim custom As Customization Dim Users As CustomizationUsers Dim UGroups As CustomizationUsersGroups Dim UGrp As CustomizationUsersGroup Set custom = tdc.Customization Set Users = custom.Users 'Get the group to which the new user will belong. Set UGroups = custom.UsersGroups Set UGrp = UGroups.Group("Developer") ' Create the user. Users.AddSiteUser "Lancelot", _ "Lancelot DuLac", "Lance@RoundTable.co.uk", _ "From far-off France I hear your call", _ "(215)PA-6-5000", UGrp custom.Commit Debug.Print Users.UserExistsInSite("Lancelot") Debug.Print Users.Users.Count ' Get before and after adding to project. ' Add to current project. Users.AddUser ("Lancelot") custom.Commit ' Count is one more than before. Only project users ' are returned from Customization.Users.Count. Debug.Print Users.Users.Count ' Check the new user's attributes. Dim usr As CustomizationUser Set usr = Users.User("Lancelot") With usr Debug.Print .name, .Phone, .Email End With End Sub |