Link to home
Start Free TrialLog in
Avatar of GlennCameron
GlennCameron

asked on

getDocsMetaInfo RPC call

Can anyone provide a simple code example for using the getDocsMetaInfo RPC to retrieve property from a document in SharePoint.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Russell_Venable
Russell_Venable
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here's how I'd do it:
string parameters =
"method=getDocsMetaInfo:6.0.n.nnnn&url_list=[global.asa]&listHiddenDocs=false&listLinkInfo=true"

HttpPost("http://the_site/_vti_bin/_vti_aut/author.dll", parameters);


string HttpPost (string uri, string parameters)
{ 	
   WebRequest webRequest = WebRequest.Create (uri);
  
      webRequest.ContentType = "txt/html";
   webRequest.Method = "POST";
   byte[] bytes = Encoding.ASCII.GetBytes (parameters);
   Stream os = null;
   try
   { 
      webRequest.ContentLength = bytes.Length;
      os = webRequest.GetRequestStream();
      os.Write (bytes, 0, bytes.Length);        
   }
   catch (WebException ex)
   {
      MessageBox.Show ( ex.Message, "HttpPost: Request error", 
         MessageBoxButtons.OK, MessageBoxIcon.Error );
   }
   finally
   {
      if (os != null)
      {
         os.Close();
      }
   }
 
   try
   { 
      WebResponse webResponse = webRequest.GetResponse();
      if (webResponse == null) 
         { return null; }
      StreamReader sr = new StreamReader (webResponse.GetResponseStream());
      return sr.ReadToEnd ().Trim ();
   }
   catch (WebException ex)
   {
      MessageBox.Show ( ex.Message, "HttpPost: Response error", 
         MessageBoxButtons.OK, MessageBoxIcon.Error );
   }
   return null;
}

Open in new window