Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

add user to group

Avatar

Level 2

please help me to add user to group using dotnet(C#),

1 Reply

Avatar

Level 10

See http://help.adobe.com/en_US/enterpriseplatform/10.0/programLC/help/index.html

API Quick Starts (Code Examples) > User Manager API Quick Starts > Quick Start (MTOM): Adding users using the web service API

/**

* Ensure that you create a .NET project that uses

* MS Visual Studio 2008 and version 3.5 of the .NET

* framework. This is required to invoke a

* LiveCycle ES2 service using MTOM.

*    

* For information, see "Invoking LiveCycle ES2 using MTOM" in Programming with LiveCycle ES2 

*/

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.ServiceModel;

using System.IO;

//A reference to the DirectoryManager service

using AddUser.ServiceReference1;

namespace AddUser

{

    class Program

    {

        static void Main(string[] args)

        {

            try

            {

                //Create a DirectoryManagerServiceClient object

                DirectoryManagerServiceClient dirManClient = new DirectoryManagerServiceClient();

                dirManClient.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://hiro-xp:8080/soap/services/DirectoryManagerService?blob=mtom");

                //Enable BASIC HTTP authentication

                BasicHttpBinding b = (BasicHttpBinding)dirManClient.Endpoint.Binding;

                b.MessageEncoding = WSMessageEncoding.Mtom;

                dirManClient.ClientCredentials.UserName.UserName = "administrator";

                dirManClient.ClientCredentials.UserName.Password = "password";

                b.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;

                b.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;

                b.MaxReceivedMessageSize = 2000000;

                b.MaxBufferSize = 2000000;

                b.ReaderQuotas.MaxArrayLength = 2000000;

                //Create a User object            

                UserImpl myUser = new UserImpl();

                myUser.domainName = "DefaultDom";

                myUser.userid = "wblue";

                myUser.canonicalName = "wblue";

                myUser.principalType = "USER";

                myUser.givenName = "Wendy";

                myUser.familyName = "Blue";

                myUser.disabled = false;

                //Add the user to LiveCycle ES2

                dirManClient.createLocalUser(myUser, "password");

                //Ensure that the user was added

                //Create a PrincipalSearchFilter to find the user by ID

                PrincipalSearchFilter psf = new PrincipalSearchFilter();

                psf.userId = "wblue";

                MyArrayOfUser allUsers = dirManClient.findUsers(psf);

                //Determine how many elements there are

                //Each element is of type User

                int index = allUsers.Count;

                //Iterate through the array

                for (int i = 0; i < index; i++)

                {

                    User theUser =(User) allUsers[i];

                    Console.WriteLine("User ID: " + theUser.userid);

                    Console.WriteLine("User name: " + theUser.givenName + " " + theUser.familyName);

                    Console.WriteLine("User Domain: " + theUser.domainName);

                }

            }

            catch (Exception ee)

            {

                Console.WriteLine(ee.Message);

            }

        }

    }

}

Steve

The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now