次の方法で共有


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
        NewListing.Update()

    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

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

    Thank you!
  • Anonymous
    July 11, 2004
    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...
  • Anonymous
    August 10, 2004
    Been searching for how to do this via Sharepoint Webservices but can't seem to find the method. Is it exposed as a webservice?
  • Anonymous
    June 09, 2009
    PingBack from http://quickdietsite.info/story.php?id=14707