Creating Portal Listing with HTML Content

You all out there may be a little sharper than me, but one thing that took me some time to work out is exactly how to create a new Portal listing with HTML content. In the end I worked this out, thought it might be useful to share the code with you:

    Sub AddNews(ByVal Title As String, ByVal ListingText As String, ByVal NewsID As String, ByVal PubDate As Date)
        Dim NewListing As Microsoft.SharePoint.Portal.SiteData.AreaListing
        Dim Audience() As Guid

        If Title.Length > 100 Then
            Title = Title.Substring(0, 100)
        End If

        NewListing = TargetNewsArea.Listings.AddListing(Title, "", Portal.SiteData.ListingType.News, "", Audience)
        NewListing.HtmlBlob = ListingText="BR">        NewListing.URL = "/txtlstvw.aspx?LstID=" + NewListing.ID.ToString
        NewListing.AppearanceDate = PubDate

    End Sub

 Now as you know, I'm a few "If clauses" short of a case statement when it comes to development, so any more effiecient routines encouraged.

Comments (4)
  1. Eric says:

    Hi, this sample is great! However, I am the newbie to coding. Could you perovide this example in C#?

    Thank you!

  2. Daniel McPherson says:

    Sorry Eric, I’m a VB jock, have an alergy to C#. Really shouldn’t be too hard though, and there are some automatic conversion tools out there I believe…

  3. Rory says:

    Been searching for how to do this via Sharepoint Webservices but can’t seem to find the method. Is it exposed as a webservice?

Comments are closed.

Skip to main content