Compartilhar via


use SharePoint's web services to access list data using FrontPage

Windows SharePoint Services ships with some really powerful web services that allow users to access list and site information not available through other means. FrontPage 2003 allows users to access these web services in a very straight forward manner, populating all of the query fields dynamically so that little or no knowledge of SOAP is required.

This example here describes how to use the Data View Web Part to access the lists.asmx web service to display the Attachments on list items in wss. In order to make this as easy to describe as possible, I will use the Announcements list.

So, to start, I browse to the announcements list on my server: https://myserver/subsite/lists/announcements/forms/allitems.aspx and add a new announcement. The title is 'foo' and I click to add an attachment which is called attachment.htm. By default, I now have two announcements in my list, one with title "Welcome to Windows SharePoint Services..." and one with title "foo." I open this site in FrontPage 2003 and create a new blank page on which to work.

  1. Data..Insert Data View
  2. In the Data Source Catalog, Right click Announcements > Show Data
  3. In the Data View Details taskpane, select the Title and the Body and click "Insert Data View" (this should create a data view web part on your blank page displaying the Title and Body for the two announcements)
  4. Data..Insert Data View
  5. Expand the "XML Web Services" section of the Catalog
  6. Click "Add to Catalog"
  7. In the "Service Description Location" type: https://myserver/subsite/_vti_bin/lists.asmx
  8. Click "Connect now"
  9. Under "Operation" change to the "GetAttachmentCollection" method
  10. Double click "listName" and set the value to "Announcements"..OK
  11. Double click "listItemID" and set the value to '2' (without the quotes - this is the ID of the item that has the attachment from above, if you set this value to 1, step 14 will not work), check the box that "The value of this parameter can be set at runtime" ..OK
  12. Click OK to the Data Source Properties dialog
  13. Right click this new data source in the Data Source Catalog > Show Data
  14. You should see the path to your attachment load in the Data View Details tree
  15. Place your cursor under the DVWP you inserted in step 3
  16. Select the "Attachment" data value in the DVD tree and click "Insert Data View" (you should now have two data views on your page, one of the titles and body and one of the attachments)
  17. Right click the Data Value to the Attachment and Format Items As > Hyperlink
  18. Right click the first data view > Web Part Connections
  19. Use the Connections wizard to create a connection which will pass the ID value from the first data view to the second
    1. PROVIDE DATA VALUES TO > NEXT
    2. CONNECT TO A WEB PART ON THIS PAGE > NEXT
    3. TARGET WEB PART: Lists on Subsite; TARGET ACTION: Modify web part using Parameters from > NEXT
    4. COLUMNS IN ANNOUNCEMENTS: ID; INPUTS TO LISTS: listItemID >NEXT (if you don't have listItemID, you forgot to check the box in step 11)
    5. CREATE A HYPERLINK ON TITLE and INDICATE CURRENT SELECTION USING: ID > NEXT
    6. FINISH
  20. Save the Page and Preview in the Browser
  21. Click on "Foo" and you will see the Link to its attachment. Click the link and see the Attachment load in your browser.

I hope that this introduction to web services in SharePoint and FrontPage inspires you to check out all the other methods. Let us know what problems you've solved by using these web services!

Thanks!

Comments