@@ -93,14 +93,14 @@ public async Task<ActionResult> SendNotificationToUser(TaskDetails taskDetails)
9393 if ( taskDetails . taskInfoAction == "customTopic" )
9494 {
9595 ChatMessageHelper chatMessage = new ChatMessageHelper ( _configuration ) ;
96- var getChannelMessage = await chatMessage . CreateChatMessageForChannel ( taskDetails , taskDetails . access_token ) ;
96+ // var getChannelMessage = await chatMessage.CreateChatMessageForChannel(taskDetails, taskDetails.access_token);
9797 var requestBody = new Microsoft . Graph . Beta . Users . Item . Teamwork . SendActivityNotification . SendActivityNotificationPostRequestBody
9898 {
9999 Topic = new TeamworkActivityTopic
100100 {
101101 Source = TeamworkActivityTopicSource . Text ,
102102 Value = "Deployment Approvals Channel" ,
103- WebUrl = getChannelMessage . WebUrl
103+ WebUrl = "https://teams.microsoft.com/l/entity/" + _configuration [ "AzureAd:MicrosoftAppId" ]
104104 } ,
105105 ActivityType = "taskCreated" ,
106106 PreviewText = new ItemBody
@@ -111,15 +111,15 @@ public async Task<ActionResult> SendNotificationToUser(TaskDetails taskDetails)
111111 {
112112 new Microsoft . Graph . Beta . Models . KeyValuePair
113113 {
114- Name = "taskId " ,
115- Value = "12322 ",
114+ Name = "taskName " ,
115+ Value = taskDetails . taskName ?? "New Task ",
116116 } ,
117117 } ,
118118 IconId = "taskCreatedId"
119119 } ;
120120 try
121121 {
122- await graphClient . Users [ "{userId}" ] . Teamwork
122+ await graphClient . Users [ _configuration [ "AzureAd:UserId" ] ] . Teamwork
123123 . SendActivityNotification . PostAsync ( requestBody ) ;
124124 }
125125 catch ( Exception ex )
@@ -148,14 +148,14 @@ await graphClient.Users["{userId}"].Teamwork
148148 new KeyValuePair
149149 {
150150 Name = "taskName" ,
151- Value = "12322 ",
151+ Value = taskDetails . taskName ?? "New Task ",
152152 } ,
153153 } ,
154154 IconId = "taskCreatedId"
155155 } ;
156156 try
157157 {
158- await graphClient . Users [ "{userId}" ] . Teamwork
158+ await graphClient . Users [ _configuration [ "AzureAd:UserId" ] ] . Teamwork
159159 . SendActivityNotification . PostAsync ( requestBody ) ;
160160 }
161161 catch ( Exception ex )
@@ -194,7 +194,7 @@ public async Task<ActionResult> SendNotificationToGroupChat(TaskDetails taskDeta
194194 Recipient = new AadUserNotificationRecipient
195195 {
196196 OdataType = "microsoft.graph.aadUserNotificationRecipient" ,
197- UserId = "{userId}" ,
197+ UserId = _configuration [ "AzureAd:UserId" ] ,
198198 } ,
199199 TemplateParameters = new List < KeyValuePair >
200200 {
@@ -233,7 +233,7 @@ await graphClient.Chats[taskDetails.chatId]
233233 Recipient = new AadUserNotificationRecipient
234234 {
235235 OdataType = "microsoft.graph.aadUserNotificationRecipient" ,
236- UserId = "{userid}" ,
236+ UserId = _configuration [ "AzureAd:UserId" ] ,
237237 } ,
238238 TemplateParameters = new List < KeyValuePair >
239239 {
@@ -378,7 +378,7 @@ await graphClientApp.Teams[taskDetails.teamId]
378378 Recipient = new AadUserNotificationRecipient
379379 {
380380 OdataType = "microsoft.graph.aadUserNotificationRecipient" ,
381- UserId = "{userId}" ,
381+ UserId = _configuration [ "AzureAd:UserId" ] ,
382382 } ,
383383 TemplateParameters = new List < KeyValuePair >
384384 {
0 commit comments