Because Core Messaging Module doesn't support HTML I need to create my own module based on DotNetNuke.Services.Social.Messaging.MessagingController and DotNetNuke.Services.Social.Messaging.Message.
The only problem I have is how to replay to a message?
In the table dbo.CoreMessaging_Messages there is a field ConversationId that keep a Message ID from the original message.
Let say original message has MessageID #123. I need to replay to this message and I'm expecting that ConversationId will have this 123.
It works if I open a message Core Messaging Module page and click replay. But I'm not able to do it programmatically.
I login as user 1, creating a message. Now both MessageID and ConversationId have the same value 123.
I'm login from another browser under user 2 user name, creating a message and assign a value to the property .DotNetNuke.Services.Social.Messaging.Message.ConversationId the same value 123.
It doesn't work. Message created by ConversationId has a different value (for example 124).
In both original and replay message subject hasn't chnaged
Here is my code.
Private Sub SendSocialMessage()
Dim Mymessage As New DotNetNuke.Services.Social.Messaging.Message
Dim mc As New DotNetNuke.Services.Social.Messaging.MessagingController
Dim oUser As New UserInfo
Dim oSender As New UserInfo
Dim _PortalSettings As PortalSettings = PortalController.Instance.GetCurrentPortalSettings
Dim UserList As New List(Of UserInfo)
Try
oSender = _PortalSettings.UserInfo
Dim rec As String = ""
If oSender.Username = "user1" Then
rec = "user2"
Else
rec = "user1"
End If
oUser = UserController.GetUserByName(0, rec)
UserList.Add(oUser)
With Mymessage
.Body = "Some Body Text"
.Subject = "some subject text"
.From = oSender.Username
.SenderUserID = oSender.UserID
.To = oUser.Username
.ConversationId = 123
.MessageID = 123
.KeyID = 123
.ReplyAllAllowed = True
End With
mc.SendMessage(Mymessage, Nothing, UserList, Nothing, oSender)
Response.Write("Ok")
Catch ex As Exception
Functions.SaveError(ex)
Response.Write(ex.Message)
End Try
End Sub
Thanks.