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: http://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.
- Data..Insert Data View
- In the Data Source Catalog, Right click Announcements > Show Data
- 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)
- Data..Insert Data View
- Expand the “XML Web Services” section of the Catalog
- Click “Add to Catalog”
- In the “Service Description Location” type: http://myserver/subsite/_vti_bin/lists.asmx
- Click “Connect now”
- Under “Operation” change to the “GetAttachmentCollection” method
- Double click “listName” and set the value to “Announcements”..OK
- 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
- Click OK to the Data Source Properties dialog
- Right click this new data source in the Data Source Catalog > Show Data
- You should see the path to your attachment load in the Data View Details tree
- Place your cursor under the DVWP you inserted in step 3
- 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)
- Right click the Data Value to the Attachment and Format Items As > Hyperlink
- Right click the first data view > Web Part Connections
- Use the Connections wizard to create a connection which will pass the ID value from the first data view to the second
- PROVIDE DATA VALUES TO > NEXT
- CONNECT TO A WEB PART ON THIS PAGE > NEXT
- TARGET WEB PART: Lists on Subsite; TARGET ACTION: Modify web part using Parameters from > NEXT
- COLUMNS IN ANNOUNCEMENTS: ID; INPUTS TO LISTS: listItemID >NEXT (if you don’t have listItemID, you forgot to check the box in step 11)
- CREATE A HYPERLINK ON TITLE and INDICATE CURRENT SELECTION USING: ID > NEXT
- Save the Page and Preview in the Browser
- Click on “Foo” and you will see the Link to its attachment. Click the link and see the Attachment load in your browser.