@@ -151,6 +151,8 @@ public class MicrosoftCommonServiceImpl implements MicrosoftCommonService {
151
151
private static final String LINK_TYPE_EDIT = "edit" ;
152
152
private static final String LINK_TYPE_VIEW = "view" ;
153
153
private static final String LINK_SCOPE_USERS = "users" ;
154
+ private static final int TEAM_CHARACTER_LIMIT = 80 ;
155
+ private static final int CHANNEL_CHARACTER_LIMIT = 50 ;
154
156
155
157
156
158
@ Setter private ServerConfigurationService serverConfigurationService ;
@@ -529,7 +531,9 @@ public String createTeam(String name, String ownerEmail) throws MicrosoftCredent
529
531
try {
530
532
LinkedList <String > rolesList = new LinkedList <String >();
531
533
rolesList .add ("owner" );
532
-
534
+
535
+ String truncatedName = name .length () > TEAM_CHARACTER_LIMIT ? name .substring (0 , TEAM_CHARACTER_LIMIT ) : name ;
536
+
533
537
User userOwner = getGraphClient ().users (ownerEmail ).buildRequest ().get ();
534
538
AadUserConversationMember conversationMember = new AadUserConversationMember ();
535
539
conversationMember .oDataType = "#microsoft.graph.aadUserConversationMember" ;
@@ -544,8 +548,8 @@ public String createTeam(String name, String ownerEmail) throws MicrosoftCredent
544
548
ConversationMemberCollectionPage conversationMemberCollectionPage = new ConversationMemberCollectionPage (conversationMemberCollectionResponse , null );
545
549
546
550
Team team = new Team ();
547
- team .displayName = name ;
548
- team .description = name ;
551
+ team .displayName = truncatedName ;
552
+ team .description = truncatedName ;
549
553
team .visibility = TeamVisibilityType .PRIVATE ;
550
554
team .members = conversationMemberCollectionPage ;
551
555
team .
additionalDataManager ().
put (
"[email protected] " ,
new JsonPrimitive (
"https://graph.microsoft.com/v1.0/teamsTemplates('standard')" ));
@@ -568,8 +572,8 @@ public String createTeam(String name, String ownerEmail) throws MicrosoftCredent
568
572
Map <String , MicrosoftTeam > teamsMap = (Map <String , MicrosoftTeam >)cachedValue .get ();
569
573
teamsMap .put (teamId , MicrosoftTeam .builder ()
570
574
.id (teamId )
571
- .name (name )
572
- .description (name )
575
+ .name (truncatedName )
576
+ .description (truncatedName )
573
577
.build ());
574
578
575
579
getCache ().put (CACHE_TEAMS , teamsMap );
@@ -1079,10 +1083,12 @@ public Map<String, MicrosoftChannel> getTeamPrivateChannels(String teamId, boole
1079
1083
@ Override
1080
1084
public String createChannel (String teamId , String name , String ownerEmail ) throws MicrosoftCredentialsException {
1081
1085
try {
1086
+ String truncatedName = name .length () > CHANNEL_CHARACTER_LIMIT ? name .substring (0 , CHANNEL_CHARACTER_LIMIT ) : name ;
1087
+
1082
1088
Channel channel = new Channel ();
1083
1089
channel .membershipType = ChannelMembershipType .PRIVATE ;
1084
- channel .displayName = formatMicrosoftString (name );
1085
- channel .description = name ;
1090
+ channel .displayName = formatMicrosoftString (truncatedName );
1091
+ channel .description = truncatedName ;
1086
1092
1087
1093
User userOwner = getGraphClient ().users (ownerEmail ).buildRequest ().get ();
1088
1094
AadUserConversationMember conversationMember = new AadUserConversationMember ();
0 commit comments