예제 #1
0
 public static void GetListItemByID(Uri webUri, string userName, string password, string LstTitle, string itemId)
 {
     using (var client = new SPHttpClient(webUri, userName, password))
     {
         //var listTitle = "Tasks";
         //var itemId = 1;
         var endpointUrl = string.Format("{0}/_api/web/lists/getbytitle('{1}')/items({2})", webUri, LstTitle, itemId);
         var data        = client.ExecuteJson(endpointUrl);
         //Console.WriteLine(data["Title"]);
     }
 }
예제 #2
0
 public static void GetListItems(Uri webUri, string userName, string password, string LstTitle)
 {
     using (var client = new SPHttpClient(webUri, userName, password))
     {
         var listTitle   = LstTitle;
         var endpointUrl = string.Format("{0}/_api/web/lists/getbytitle('{1}')/items", webUri, listTitle);
         //The JSON Result
         var data = client.ExecuteJson(endpointUrl);
         //foreach (var item in data["Value"])
         //{
         //	Console.WriteLine(item["Title"]);
         //}
     }
 }