Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
JGraph
>
Tutorial
> Create chat
The following example shows you how to create a new chat.
import java.io.IOException; import com.independentsoft.graph.GraphClient; import com.independentsoft.graph.GraphException; import com.independentsoft.graph.teams.Chat; import com.independentsoft.graph.teams.ConversationMember; public class Console { public static void main(String[] args) { try { GraphClient client = new GraphClient(); client.setClientId("63333333-209e-454e-b7bd-55a4d201270f"); client.setTenant("independentsoft.onmicrosoft.com"); client.setClientSecret("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); ConversationMember member1 = new ConversationMember(); member1.setDisplayName("User1"); member1.setUserId("info@independentsoft.onmicrosoft.com"); member1.getRoles().add("owner"); ConversationMember member2 = new ConversationMember(); member2.setDisplayName("User2"); member2.setUserId("projects@independentsoft.onmicrosoft.com"); member2.getRoles().add("owner"); Chat chat = new Chat(); chat.setTopic("Test chat"); chat.getMembers().add(member1); chat.getMembers().add(member2); Chat createdChat = client.createChat(chat); System.out.println("Chat Id: " + createdChat.getId()); } catch (GraphException e) { System.out.println(e.getCode()); System.out.println(e.getMessage()); e.printStackTrace(); } } }
Need help? Ask our developers:
Name*
Email*
Message*