次の方法で共有


Use jQuery to make FrontPage requests

Hi,

It is interesting to see JQuery growing in the SharePoint space. For sure client APIs will enrich the ecosystem of SharePoint applications.

Some time ago, we needed a way to get some information we were storing in the property bag of our SPWebs. As the process to store the values were automated and the tests done programmatically; we really didn't care about any tool to manually check its values.

But, the day arrived and we needed to review them in preproduction environment. So how will you do it? well there are several ways to do it:

  1. Create a console/web application and implement it through the OM.
  2. Open SharePoint Designer and read them
  3. Install third party solution to do the job

They are all good candidates, but we couldn't neither install nor run a SPD instance or custom code; so I decided to run a web page :)

Here it is when JQuery comes to the rescue:

  1. Download JQuery library from jquery.com and upload it to a (test) document library
  2. Create a webpartpage in the same document library
  3. Drop a content web editor webpart on any webpartzone
  4. Update the contents of html with something similar to the following snippet, where the path starts from the web you want information from:

<script type="text/javascript" src="jquery-1.3.1.min.js"></script>
<script>
$.ajaxSetup({
        beforeSend: function(xhr) {xhr.setRequestHeader("Accept", "auth/sicily");xhr.setRequestHeader("X-Vermeer-Content-Type", "application/x-www-form-urlencoded");}
});

$.post("/site/_vti_bin/_vti_aut/author.dll", { method: "open service"},
  function(data){
    $("#vermeer_content").append(data);
  });
</script>
<div id="vermeer_content">
</div>

you will get something like this:

JQuery Response FRPC

the sample just sends a request with a method that provides meta-information for a Web site, in this case to our client application.

 method=open service:server_extension_version&service_name=/[&effective_protocol_version=version]
 References:

open service Method

[MS-FPSE]: FrontPage Server Extensions Remote Protocol Specification