PROPFIND Sample Code

                 

 
Special Edition Using Microsoft SharePoint Portal Server
By Robert  Ferguson

Table of Contents
Chapter  16.   Using WebDAV Protocol to Create Web Parts


In this example, we will use the PROPFIND WebDAV method to retrieve the properties of the promotoc4.doc MS Word document, located in the /DOCUMENTS/MARKETING/ APRIL / folder. We set these properties (owner, author, company, and title) in the previous example by using the PROPPATCH method.

In this example, the source identified by strURL will be the same as the source defined in the PROPPATCH sample as

 strURL = "http://" + strServer + "/" + strWorkspace + "/DOCUMENTS/MARKETING/APRIL/ graphics/ccc.gif promotoc4.doc" 

The XML string will change as follows :

 strXMLRequest = "" + _  "<?xml version='1.0'?>" + _  "<D:propfind xmlns:D='DAV:' xmlns:o='urn:schemas-microsoft-com:office:office'>" + _      "<D:prop>" + _              "<D:owner/>" + _              "<o:Author/>" + _              "<o:company/>" + _              "<o:title/>" + _       "</D:prop>" + _  "</D:propfind>" 

The method in the request header needs to be changed to PROPFIND:

 DAVRequest.open "PROPFIND", strURL, False, strUser, strPassword 
Listing 16.7 The PROPFIND Request
 PROPFIND /spsbook/documents/marketing/april/promotco4.doc HTTP/1.1 Host: dianatr Content-Type: text/xml Content-Length: XXX <?xml version='1.0'?>  <D:propfind xmlns:D='DAV:' xmlns:o='urn:schemas-microsoft-com:office:office'>       <D:prop>              <D:owner/>              <o:Author/>              <o:company/>              <o:title/>       </D:prop> </D:propfind> 

The XML response is shown in Listing 16.8.

Listing 16.8 The Web Server Response to the PROPFIND Method and the List of Properties Requested in our XML Request Body
 <?xml version="1.0" ?> <a:multistatus xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/" xmlns:c="xml:" graphics/ccc.gif xmlns:d="urn:schemas-microsoft-com:office:office" xmlns:a="DAV:"> <a:response> <a:href>http://dianatr/spsbook/Documents/Marketing/April/promotoc4.doc</a:href> <a:propstat> <a:status>HTTP/1.1 200 OK</a:status> <a:prop> <a:owner>Reza Dianat</a:owner> <d:Author>Reza Dianat</d:Author> <d:company>COMPAQ</d:company> <d:title>Promotion</d:title> </a:prop> </a:propstat> </a:response> </a:multistatus> 

                 
Top


Special Edition Using Microsoft SharePoint Portal Server
Special Edition Using Microsoft SharePoint Portal Server
ISBN: 0789725703
EAN: 2147483647
Year: 2002
Pages: 286

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net