Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using ITR.SharePoint.Client.CSOM;
- using Microsoft.SharePoint.Client;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace SP.DEMO.PROVISIONING {
- class Program {
- private static string username = "alnstrange@alnstrange.onmicrosoft.com";
- private static string siteURL = "https://alnstrange.sharepoint.com/sites/provisioning";
- //Opret SharePoint Team Site
- //Opret liste med felter: Site Title, URL, IsProvisioned
- //Hent listen ud i koden
- //opret subsite på nye elementer
- //Ryd forsiden for webparts
- //Indsæt en Youtube video på forsiden (efter ejet valg)
- static void Main(string[] args) {
- Console.WriteLine("Please enter password:");
- using (SPClientContext ctx = new SPClientContext(siteURL)) {
- ctx.Credentials = new SharePointOnlineCredentials(username, ctx.GetPasswordFromConsoleInput());
- Web web = ctx.Web;
- ctx.Load(web);
- ctx.Load(web, x => x.Lists);
- ctx.ExecuteQuery();
- Console.WriteLine(string.Format("Connected to site with title of {0}", web.Title));
- CamlQuery query = new CamlQuery();
- List myList = web.Lists.GetByTitle("testliste");
- ListItemCollection websites = myList.GetItems(query);
- ctx.Load<List>(myList);
- ctx.Load<ListItemCollection>(websites);
- ctx.ExecuteQuery();
- Console.WriteLine("Getting list items:");
- foreach (var item in websites)
- {
- string siteTitle = (string)item["Title"];
- Console.WriteLine(siteTitle);
- }
- //Console.WriteLine(web.Lists);
- //foreach (List list in web.Lists)
- //{
- // Console.WriteLine(list);
- //}
- Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement