Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
JGraph
>
Tutorial
> Create user
The following example shows you how to create an user and set user's password.
import com.independentsoft.graph.GraphClient; import com.independentsoft.graph.GraphException; import com.independentsoft.graph.users.PasswordProfile; import com.independentsoft.graph.users.User; public class Test { public static void main(String[] args) { try { GraphClient client = new GraphClient(); client.setClientId("67cb3333-209e-454e-b7bd-55a4d201270f"); client.setTenant("independentsoft.onmicrosoft.com"); client.setUsername("info@independentsoft.onmicrosoft.com"); client.setPassword("password"); PasswordProfile passwordProfile = new PasswordProfile(); passwordProfile.setPassword("QWERTY$%^123456"); User user1 = new User(); user1.setAccountEnabled(true); user1.setMailNickname("alice"); user1.setDisplayName("Alice"); user1.setPrincipalName("alice@independentsoft.onmicrosoft.com"); user1.setJobTitle("Sales manager"); user1.setDepartment("Sales"); user1.setOfficeLocation("LA"); user1.setPasswordProfile(passwordProfile); User createdUser = client.createUser(user1); } catch (GraphException e) { System.out.println(e.getCode()); System.out.println(e.getMessage()); } } }
Need help? Ask our developers:
Name*
Email*
Message*