using System.Linq; using System.Text; using System.Threading.Tasks; using System.Security; using Microsoft.SharePoint.Client; using System.Net; using Microsoft.SharePoint; namespace OneDrive { class Program { static void Main(string[] args) { GetSiteLists(); Console.ReadLine(); } class configuration { public static string o365SiteUrl = "http://mysite-my.sharepoint.com"; public static string o365UserName = "username"; public static string o365Password = "pwd"; public static string o365Domain = "domail"; } static ClientContext GetUserContext() { var o365password = new SecureString(); foreach (char c in configuration.o365Password) { o365password.AppendChar(c); } // var o365Credentials = new SharePointOnlineCredentials(configuration.o365UserName, o365password); NetworkCredential o365Credentials = new NetworkCredential(configuration.o365UserName, o365password, configuration.o365Domain ); ClientContext o365Context = new ClientContext(configuration.o365SiteUrl); System.Net.ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true); o365Context.Credentials = o365Credentials; return o365Context; } static void GetSiteLists() { var clientContext = GetUserContext(); //clientContext.ExecutingWebRequest += clientContext_ExecutingWebRequest; var results = clientContext.LoadQuery(clientContext.Web.Lists.Include(List => List.Title, List => List.Id )); clientContext.ExecuteQuery(); results.ToList().ForEach(x => { Console.WriteLine(x.Title); }); clientContext.Dispose(); } }
Quote:You can use your My Site to share information and connect with other people to build your professional network. This article describes some key features, and provides some steps to help you get started.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)