title: Sharepoint Get all lists Data c#
body: <p>I have a few problems regarding SharePoint web site and C# Integration.
  I have a SharePoint Web Site &amp; I can add files,videos into this site.
  I have Specific UI design for this site.but actually i cannot add my UI design inside this SharePoint web site(I'm not sure about this.still i'm new to SharePoint.)
  because of that i decided to take following steps.</p>
  
  <ol>
  <li>Create Asp.Net MVC Web Site and Add My UI design Inside that site.</li>
  <li>Access My SharePoint site from asp.net MVC web site.</li>
  </ol>
  
  <p>In my 2nd step my process should be like this..</p>
  
  <p>2.1 Inside some search box ,user can search 
  but in here all data should come from SharePoint data(file names,video names that i have been added)those files name should be loaded to search box like google search.</p>
  
  <p>2.2 when user select 1 file name and press search button then he should navigate to SharePoint web site.</p>
  
  <p>My SharePoint  web site is now complete.i can add videos search those things using name, can do.but this search part i need to do from my asp.net MVC web site.</p>
  
  <p>so how should i do this?</p>
  
  <p>I saw SharePoint use rest api.but i cannot find good resource regarding that.
  most of SharePoint tutorials come's for Visual Studio - SharePoint - SharePoint Solutions Projects.</p>
  
  <p>But I need to do this inside my Asp.Net MVC Application.</p>
  
  <p>i tried to do like this
  <a href="https://msdn.microsoft.com/en-us/library/office/ee538683(v=office.14).aspx" rel="nofollow">How to: Retrieve Lists</a></p>
  
  <p>but its not success &amp; i'm using SharePoint 2013 online version</p>
  
  <hr>
  
  <p><strong>Edit</strong></p>
  
  <p>This Code I tried.but not sucess.right now i tried to retrieved to data to my label or text box.</p>
  
  <pre><code>using SP = Microsoft.SharePoint.Client;
  
  string siteUrl = "http://SMit.sharepoint.com/MySiteName";
  
  SP.ClientContext clientContext = new SP.ClientContext(siteUrl);
  SP.Web oWebsite = clientContext.Web;
  SP.ListCollection collList = oWebsite.Lists;
  
  clientContext.Load(collList);
  
  clientContext.ExecuteQuery();
  
  foreach (SP.List oList in collList)
  {
      label1.Text = label1.Text + ", " + oList.Title +""+ oList.Created.ToString();
      //Console.WriteLine("Title: {0} Created: {1}", oList.Title, oList.Created.ToString());
  }
  </code></pre>
  
  <p>Following method also i tried</p>
  
  <pre><code>  string siteUrl = "http://SMit.sharepoint.com/MySiteName";
  
      using (SP.ClientContext spcontext = new SP.ClientContext(siteUrl))
                  {
                      spcontext.AuthenticationMode = SP.ClientAuthenticationMode.FormsAuthentication;
                      spcontext.FormsAuthenticationLoginInfo = new SP.FormsAuthenticationLoginInfo("userID@ddd.onmicrosoft.com", "password");
                      spcontext.Load(spcontext.Web, w =&gt; w.Title, w =&gt; w.ServerRelativeUrl, w =&gt; w.Lists);
                      spcontext.ExecuteQuery();
                      //Console.WriteLine(spcontext.Web.ServerRelativeUrl); 
  //I haven done anything here.i want to check  spcontext.ExecuteQuery(); works or //not.
                  }
  </code></pre>
  
  <p>but Now i'm getting following kind of an error.
  Error Occured on 
   spcontext.ExecuteQuery();</p>
  
  <p><strong>An unhandled exception of type 'Microsoft.SharePoint.Client.ServerException' occurred in Microsoft.SharePoint.Client.Runtime.dll
  Additional information: The user's login name or password is not valid.</strong></p>