Messaging Server Control

The Messaging server control lets a site user send and receive messages. You can limit message recipients to a user’s colleagues or expand it to all Ektron users. The Messages control can appear on a site or also in the Ektron Workarea. Typical messaging functions apply, such as compose ( in the Workarea), reply ( in the Workarea), forward ( in the Workarea), print ( in the Workarea), delete ( in a sample site, in the Workarea).

Populating the To field of a message

Populating the To: Field of a Message

You can populate a message's To: field with user names by setting the RecipientParamName property to a QueryString parameter. This feature lets you create a link on a page, such as Send a Message to this user or Send a message to all users in this group. For example, you create a Web page link to a template containing the Messaging server control, pass a user’s ID in the QueryString as UID, and populate the RecipientParamName property with UID. As a result, the server control reads the user’s ID and completes the To: field with the user’s name.

Here is how the link might look: messaging.aspx?g=pmessage&uid=1

You can pass multiple user IDs. For example: messaging.aspx?g=pmessage&uid=1&uid=20&uid=12&uid=18

WARNING! You must include the g=pmessage parameter in the QueryString to open the Messaging server control to its editor. Otherwise, the server control opens to the Inbox.

The VB example below creates a dynamic hyperlink that populates a message's To: field with a logged in user’s colleagues. For this example to work, add a Literal control to a Web form and name it Lit1. Notes are included as comment text.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim frnds As New Ektron.Cms.API.Community.Friends()
        Dim apicontent As New Ektron.Cms.ContentAPI
        Dim dirUsrData() As Ektron.Cms.DirectoryUserData

        If (apicontent.UserId > 0) Then
            dirUsrData = frnds.GetFriends(apicontent.UserId)
            If ((Not IsNothing(dirUsrData)) AndAlso (dirUsrData.Length > 0)) Then
                Dim idx As Integer
                Dim friendsList As String = String.Empty
                For idx = 0 To dirUsrData.Length - 1
                    'friendsList += "&uid=" + dirUsrData(idx).Id.ToString()
                    friendsList = friendsList + "&uid=" 
                      + dirUsrData(idx).Id.ToString()
                Next
                Lit1.Text = "<a href=""MsgSample.aspx?g=pmessage" + friendsList 
                  + """>Send a message to my friends</a>"
'
'Replace MsgSample.aspx with the Web form that contains 
'the messaging server control.
'Set the RecipientParamName property to "uid" for this example.
'
            Else
                Lit1.Text = "The logged in user currently has no friends"
				

            End If
        Else
            Lit1.Text = "You must be logged in to run this demo"
        End If
        apicontent = Nothing
        frnds = Nothing
    End Sub		
Messaging server control properties

Messaging Server Control Properties

The following are Ektron-specific server control properties. You can find information about native .NET properties such as font, height, width and border style in Visual Studio® help.

  • Authenticated (String)

    Indicates if you are logged into the CMS Explorer and can use it to browse to content, collections, and so on. See Also: Browsing Your Ektron Site Using CMS Explorer.

  • DisplayXslt (String)

    If desired, enter a relative or absolute path to an Xslt that determines the display of the page.

    WARNING! If you specify an external file, do not store this file in the Workarea folder. If you store this file in the Workarea folder, the file will be lost when you upgrade.

  • DoInitFill (Boolean)

    By default, Fill occurs during the Page_Init event. Set to false if you want to postpone the fill-action until later. In this case, Fill is automatically called during the Page Render event. You might do this if you need to set or change a property on the control in code-behind and have it render with your changes shown.

  • EnablePreSearch (Boolean)

    When set to True, all users are pre-loaded and displayed in the search results when browsing for users (an empty string search). If the FriendsOnly property is set to True, only colleagues are pre-loaded and displayed.

  • FriendsOnly (Boolean)

    When set to True, users can only send messages to their colleagues.

    • True (default)—send messages to colleagues only
    • False—send messages to all Ektron users
  • GroupParamName (String)

    Enter the QueryString parameter used to pass the ID of a community group. The default is gid. Use this property to email all members of a group.

  • Hide (Boolean)

    Hides or displays the output of the control in design time and run time.

    • True—Hide the control output.
    • False—Display the control output.
  • Language (Integer)

    Set a language for viewing content; shows results in design-time (in Visual Studio) and at run-time (in a browser).

  • ProfileParamName (String)

    The QueryString parameter used to pass the ID of a user to a profile page or location template when a user name is clicked in the Browse User screen. The default is ID. The parameter defined in this property is appended to the QueryString of the path defined in the ProfileUrl property. The default is ID.

    WARNING! This parameter must match the parameter set in the UserProfile server control’s DynamicParameter property on the page defined in the ProfileUrl property.

  • ProfileUrl (String)

    The URL of the profile page template. This page opens in a new window when a user clicks a display name on the Browse Users screen. This provides additional profile information about the potential message recipient.

  • RecipientParamName (String)

    Enter the QueryString parameter used to pass a user ID. For example, if the QueryString is ?uid=1, enter uid in this property. To pass several users, enter a comma -separated list of user IDs. For example: ?uid=1,20,12,18. This property is typically used when you want to populate a message's To: field. See Also: Populating the To: Field of a Message

  • Stylesheet (String)

    Specify the path to a style sheet for use with this server control. The location can be relative or absolute. Leave blank to use the default style sheet.

    WARNING! If you enter a valid EkML file at the MarkupLanguage property, the Stylesheet property is ignored.

  • SuppressWrapperTags (Boolean)

    Suppresses the output of the span/div tags around the control.

    • True—Suppress wrap tags.
    • False (default)—Allow wrap tags.
  • UserSearchDisplayXslt (String)

    The XSLT used to display the user search control inside the Messaging server control. The default is MsgUserSelect.xsl.

    WARNING! If you specify an external file, do not store this file in the Workarea folder. If you store this file in the Workarea folder, the file will be lost when you upgrade.

  • WrapTag (String)

    Lets a developer specify a server control’s tag.

    • Span (default)—designate an inline portion of an HTML document as a span element.
    • Div—apply attributes to a block of code.
    • Custom—Lets you use a custom tag.