Detecting SharePoint Forms Services

by Scosby Friday, September 30, 2011


The reader will learn how to use the Forms Services Feature Detection Protocol. The solution demonstrated will post a HTTP request to a SharePoint detector page without calling a SharePoint web service. This approach allows even a SharePoint Reader to use the Forms Services Feature Detection Protocol. Future posts about Forms Server will utilize the solution presented in this post.

InfoPath In SharePoint

InfoPath Forms Services, included with Microsoft SharePoint Server 2010, provides a Web browser experience for filling out InfoPath forms. InfoPath 2010 integrates with SharePoint’s Business Connectivity Services (BCS) enabling users to connect their organization's forms to important business data that is stored in external line-of-business systems such as SAP, Oracle or even Twitter! Read the InfoPath Forms Services Overview for more information.

Forms Server Detector

Using the Forms Services Feature Detection Protocol, the reader can easily detect if Forms Server exists and is enabled on a specific site. By posting a query string to the FormServerDetector.aspx page, a response of HTTP No Content 204 will be returned if the request was successful but Forms Server features are not enabled, and a HTTP OK 200 if Forms Server features are enabled. If Forms Server is enabled, the response body contains the detection result but it should always be true according to the protocol.


The solution first constructs the detector URI from the following parts: the site URL, the FormServerDetector.aspx page and the protocol query parameter. Using the detector URI, the solution posts an HTTP request and inspects the HTTP response to detect the Forms Server status for the site. The protocol specifies the client request headers should include an Accept header with */* as the value. If Forms Server is enabled, the response body will contain the following text:

<server IsFormServerEnabled = 'true' />

Code Sample

        public static bool IsFormsSevicesEnabled()


            UriBuilder builder = new UriBuilder("http://scvm1");

            builder.Path = "/_layouts/FormServerDetector.aspx";

            builder.Query = "IsFormServerEnabled=check";


            string servicePath = builder.Uri.GetComponents(UriComponents.AbsoluteUri, UriFormat.SafeUnescaped);


            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(servicePath);

            request.Accept = "*/*";

            request.UseDefaultCredentials = true;


            HttpWebResponse response = null;




                response = (HttpWebResponse)request.GetResponse();


            catch (WebException ex)


                response = (HttpWebResponse)ex.Response;



            if (response.StatusCode == HttpStatusCode.OK)


                using (System.IO.StreamReader sr = new StreamReader(response.GetResponseStream()))


                    System.Xml.Linq.XElement doc = XElement.Parse(sr.ReadToEnd());


                    XAttribute fsAttribute = doc.Attribute("IsFormServerEnabled");


                    return bool.Parse(fsAttribute.Value);




            return false;


The reader should take note of the protocol query parameter assigned to the builder.Query property. By using a value of “check” for the detection protocol query parameter, the request will be processed by the protocol server. This solution provides broad support for remote clients to detect Forms Server capabilities, but without resorting to checking for SharePoint Feature definitions.

More Information

·         InfoPath Forms Services Overview

·         Forms Services Feature Detection Protocol Specification [MS-FSFDP]

·         Request for Forms Server Detection

Tags: ,

IT | Programming

blog comments powered by Disqus