J-O Eriksson

Community Server on my mind

News

Subscribe via FeedBurner

Subscribe via email

<script type="text/javascript"><!-- google_ad_client = "pub-6305396639794057"; google_ad_width = 120; google_ad_height = 240; google_ad_format = "120x240_as"; google_ad_type = "text_image"; google_ad_channel ="5472463295"; google_color_border = "FFFFFF"; google_color_link = "0000FF"; google_color_bg = "FFFFFF"; google_color_text = "000000"; google_color_url = "008000"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>

Subscribe in NewsGator Online

Subscribe in Bloglines

Add to Google

<script type="text/javascript" src="http://embed.technorati.com/embed/tb2ijzxn26.js"></script>

Blogs I read

Links

Take care of the results from a WSS Web Service (part 2)

In an earlier post I talked a little about recieving the XML result from a request to a WSS Web Service. In this post I thought I talk a bit more on this topic. I said in the previous post that I built a couple of classes to recieve the XML results.

To create these classes I also use XML attributes defined in the namespace System.Xml.Serialization. So the classes to hold i.e. LastName and FirstName from a contact list could look like this;

Imports System.Xml.Serialization
<XmlRoot(ElementName:="listitems",
Namespace:="http://schemas.microsoft.com/sharepoint/soap/")> _
Public Class ListResults
    <XmlElement(ElementName:="data",
Namespace:="urn:schemas-microsoft-com:rowset")> _
      
Public Data As ListData
End Class
Public Class ListData
   
Public Sub New()
   
End Sub
    <XmlAttributeAttribute("ItemCount")> _
   
Public ItemCount As Int32
    <XmlElement(ElementName:="row",
Namespace:="#RowsetSchema")> _
   
Public Items As ListItem()
End Class
Public Class ListItem
   
Private m_LastName As String
    Private m_FirstName As String
    Public Sub New()
   
End Sub
    <XmlAttributeAttribute("ows_Title")> _
   
Public Property LastName() As String
        Get
            Return m_LastName
       
End Get
        Set(ByVal Value As String)
            m_LastName
= Value
       
End Set
   
End Property
    <XmlAttributeAttribute("ows_FirstName")> _
   
Public Property FirstName() As String
        Get
            Return m_FirstName
       
End Get
        Set(ByVal Value As String)
            m_FirstName
= Value
       
End Set
   
End Property
End Class

The ListItem class can easily be extended to hold more fields from the contact list, or customized to hold data from an entirely different WSS list.

Maybe you wonder why the field for LastName has the attribute ows_Title? Well, that's WSS's behaviour that it in a newly created list always create a field called Title. You cannot delete that field, but you can change it's DisplayName. But the underlying field name remains.

Comments

No Comments