title: Sharepoint 2010 Client Object Module getting a site url list
body: <p>I’m trying to learn SharePoint Client Object Model, specifically how to get a list of all SharePoint site URLs using a remote connection.  This is possible using webservices…but I want to do it using the client object model.</p>
  
  <p>I’ve figured how to get the title lists of a specific sharepoint site using the following code:</p>
  
  <pre><code>client object module):
    ClientContext  ctx = new ClientContext( server );
    ctx.AuthenticationMode = ClientAuthenticationMode.Default;
    ctx.Credentials = WindowsAuthenticationCredentials(username, password);
  
   Web w = ctx.Web;
  var lists = ctx.LoadQuery(w.Lists);
   ctx.ExecuteQuery();
  
  //Enumerate the results.
  foreach (List theList in lists)
  {
  
  }
  </code></pre>
  
  <p>Output:</p>
  
  <p>Announcements,  Master Collection Pages… etc…</p>
  
  <p>How can I do the same to get a site url list?</p>
  
  <p>In web services you can call the following to achieve that, but as I said just trying to figure out how to do the same using client object module.  If you can provide c# code that would greatly be appreciated.</p>
  
  <pre><code>WSPSitedata.SiteData sitedata = new SiteData();
  sitedata.Url = @SharePointBaseURL + @"_vti_bin/sitedata.asmx";
  sitedata.Credentials = our_credentials
  _sSiteMetadata metaData = new _sSiteMetadata();
  _sWebWithTime[] webWithTime 
   sitedata.GetSite(out metaData, out webWithTime, out users, out groups, out vgroups);
  </code></pre>