Skip to content

Create one-on-one chat for two Microsoft users on same tenant #2452

@ddugovic

Description

@ddugovic

Describe the bug

Using https://learn.microsoft.com/en-us/graph/api/chat-post?view=graph-rest-1.0 I am trying to create a one-on-one chat between two Microsoft users on my local domain, so my business can replace our proprietary chat server. Instead, there are errors serializing or deserializing the request which do not occur when using Postman to hit the endpoint directly.

I currently do not have the error message, but yesterday Graph SDK/API was reporting an "abstract class" despite AadUserConversationMember not being abstract.

Expected behavior

New Teams chat is created and API returns the chat ID, which my Java application can open using a deep link (just like it does for existing one-on-one chats).

How to reproduce

Chat request = new Chat();
request.setChatType(ChatType.OneOnOne);
var members = ids.stream().map(id -> {
  var member = new AadUserConversationMember();
  member.setRoles(List.of("owner"));
  member.setUserId(id);
  member.setAdditionalData(Map.of("user@odata.bind", "https://graph.microsoft.com/v1.0/users('%s')".formatted(id)));
  return (ConversationMember)member;
}).collect(Collectors.toList());
request.setMembers(members);
return client.chats().post(request);

SDK Version

6.48.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

- OS: Windows 11
- Architecure: x64

Errors seem to originate from the tenant API server, so it seems unlikely this is configuration-specific.

### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:waiting-for-triageAn issue that is yet to be reviewed or assignedtype:bugA broken experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions