This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Web web = context.Site.RootWeb; | |
List pagesLibrary = context.Web.Lists.GetByTitle("Site Pages"); | |
ListItem item = pagesLibrary.RootFolder.Files.AddTemplateFile("/sites/GautamIIWDevSite/SitePages/mymodernpage2.aspx", TemplateFileType.ClientSidePage).ListItemAllFields; | |
// Make this page a "modern" page | |
item["ContentTypeId"] = "0x0101009D1CB255DA76424F860D91F20E6C4118"; | |
item["Title"] = "My Modern Page2"; | |
item["ClientSideApplicationId"] = "b6917cb1-93a0-4b97-a84d-7cf49975d4ec"; | |
item["PageLayoutType"] = "Article"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string siteUrl = "https://tenantname.sharepoint.com/sites/testsitecollection"; | |
string userName = "user.name@tenantname.com"; | |
string password = "password"; | |
using (ClientContext context = new ClientContext(siteUrl)) | |
{ | |
SecureString securePassword = new SecureString(); | |
foreach (char c in password.ToCharArray()) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Web web = context.Site.RootWeb; | |
List pagesLibrary = context.Web.Lists.GetByTitle("Site Pages"); | |
ListItem item = pagesLibrary.RootFolder.Files.AddTemplateFile("/sites/test/SitePages/mymodernpage.aspx", TemplateFileType.ClientSidePage).ListItemAllFields; | |
// Make this page a "modern" page | |
item["ContentTypeId"] = "0x0101009D1CB255DA76424F860D91F20E6C4118"; | |
item["Title"] = "My Modern Page"; | |
item["ClientSideApplicationId"] = "b6917cb1-93a0-4b97-a84d-7cf49975d4ec"; | |
item["PageLayoutType"] = "Article"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Web web = context.Site.RootWeb; | |
List pagesLibrary = context.Web.Lists.GetByTitle("Site Pages"); | |
ListItem item = pagesLibrary.GetItemById(1); | |
//custom choice column named Category | |
//add/update your custom columns here | |
item["TestChoiceCol"] = "Good-day"; | |
item.Update(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function () { | |
getCurrentUserPermission('Custom List'); | |
}); | |
function getCurrentUserPermission(listName) | |
{ | |
var web,clientContext,currentUser,list; | |
clientContext = new SP.ClientContext.get_current(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var context = new ClientContext("https://sitecollection-url")) | |
{ | |
Site site = context.Site; | |
context.Load(site); | |
context.ExecuteQuery(); | |
Web web = site.RootWeb; | |
context.Load(web); | |
context.ExecuteQuery(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AuthenticationResponse | |
{ | |
public string token_type { get; set; } | |
public string scope { get; set; } | |
public int expires_in { get; set; } | |
public int expires_on { get; set; } | |
public int not_before { get; set; } | |
public string resource { get; set; } | |
public string access_token { get; set; } | |
public string refresh_token { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Task.Run(() => MainAsync()); | |
Console.ReadLine(); | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string siteUrl = "https://tenant.sharepoint.com/sites/test"; | |
string userName = "user.name@tenantname.onmicrosoft.com"; | |
string password = "password"; | |
using (ClientContext context = new ClientContext(siteUrl)) | |
{ | |
SecureString securePassword = new SecureString(); | |
foreach (char c in password.ToCharArray()) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string webUrl = "https://tenant-name.sharepoint.com/sites/appcatalog/"; | |
string username = "user.name@tenantname.onmicrosoft.com"; | |
string password = "password"; | |
SecureString secureString = new SecureString(); | |
password.ToList().ForEach(secureString.AppendChar); | |
var credentials = new SharePointOnlineCredentials(username, secureString); | |
using (ClientContext ctx = new ClientContext(webUrl)) | |
{ |
OlderNewer