title: How to read WebPart Content using SharePoint Client OM?
body: <p>I'm pretty new in SharePoint development and trying to read the content of a WebPart using SharePoint 2010 Client Object Model. Here is what I'm doing to query the WebPart content:</p>
  
  <pre><code>ClientContext ctx = new ClientContext("http://foo");
  File home = ctx.Web.GetFileByServerRelativeUrl("/SitePages/Page.aspx");
  var wpm = home.GetLimitedWebPartManager(PersonalizationScope.Shared);
  
  var query = wpm.WebParts.Include(wp =&gt; wp.Id, wp =&gt; wp.WebPart));
  var webPartDefenitions = ctx.LoadQuery(query);
  
  ctx.ExecuteQuery();
  </code></pre>
  
  <p>The problem is, what I get as result is the list of all the WebParts which simply includes ID and some basic information of that WebPart (such as Title), but I need to read the XML content of the WebPart itself instead of reading basic definition of that WebPart.</p>
  
  <p>What is the best way to read a <strong>WebPart's content</strong>?</p>
  
  <p>Thanks for your help in advance.</p>
  
  <hr>
  
  <p>PS.</p>
  
  <p>According to Trikks' comment, I checked the webpart content. It seems that the content is not bound to any sort of list or library. There are some custom data properties in there. Here is the sample:</p>
  
  <pre><code>&lt;webPart xmlns="http://schemas.microsoft.com/WebPart/v3"&gt;
      &lt;metaData&gt;
        &lt;type name="NS.SPS2010.Internet.WebParts.VenueDetails.VenueDetails, NS.SPS2010.Internet.WebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=89259c78cb06b3885" /&gt;
      &lt;/metaData&gt;
      &lt;data&gt;
        &lt;properties&gt;
          &lt;property name="WhenDetail" type="string"&gt;Monday 12:PM&lt;/property&gt;
          &lt;property name="WhereDetail" type="string"&gt;London&lt;/property&gt;
        &lt;/properties&gt;
      &lt;/data&gt;
    &lt;/webPart&gt;
  </code></pre>
  
  <p>What I'm really looking for, is accessing the values of <strong>WhenDetail</strong> and <strong>WhereDetail</strong> properties.</p>