Saturday, December 28, 2013

SharePoint 2010 RPC get web struct Method is throwing error

Hello,


I am using the below code for fetching website details using RPC.



string method = "get web struct: 14.0.2.5420";
string serviceName = "http://<servername>/_vti_bin/_vti_aut/author.dll";
string eidHead = "0";
string levels = "-1";
string includeHead = "true";

string fpRPCCallStr = "method={0}&service_name={1}&eidHead={2}&levels={3}&includeHead={4}";
method = System.Web.HttpUtility.UrlEncode(method);
fpRPCCallStr = String.Format(fpRPCCallStr, method, serviceName, eidHead, levels, includeHead);
HttpWebRequest wReq = WebRequest.Create(serviceName) as HttpWebRequest;
wReq.Credentials = new NetworkCredential("<username>", "<password>", "<domain>");
wReq.Method = "POST";
wReq.ContentType = "application/x-www-form-urlencoded";
wReq.Headers.Add("X-Vermeer-Content-Type", "application/x-vermeer-urlencoded");
wReq.Proxy = GlobalProxySelection.GetEmptyWebProxy();
using (StreamWriter strWriter = new StreamWriter(wReq.GetRequestStream()))
{
strWriter.Write(fpRPCCallStr);
}
using (HttpWebResponse WebResponse = wReq.GetResponse() as HttpWebResponse)
{
using (Stream responseStream = WebResponse.GetResponseStream())
{
using (StreamReader sr = new StreamReader(responseStream))
{
String response = sr.ReadToEnd();
}
}
}

After executing the above code, I am getting following string value in response variable:



<html><head><title>vermeer RPC packet</title></head>
<body>
<p>method=get web struct:14.0.0.6126
<p>status=
<ul>
<li>status=917507
<li>osstatus=0
<li>msg=The method 'get web struct' is not supported.
<li>osmsg=
</ul>
</body>
</html>

Kindly let me know what is wrong with the code. And also is there any other solution for fetching site collection details using SharePoint RPC?



Regards, Shruti


No comments:

Post a Comment