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
Add-Type -Path (Resolve-Path "$env:CommonProgramFiles\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll") | |
Add-Type -Path (Resolve-Path "$env:CommonProgramFiles\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll") | |
#Site collection URL | |
$siteurl = "https://tenantname.sharepoint.com/sites/testsitecollection" | |
$userName ="user.name@tenantname.com" | |
$password ="password" | |
#client context object and setting the credentials |
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
var body={ | |
"request":{ | |
"__metadata":{"type":"SP.Publishing.CommunicationSiteCreationRequest"}, | |
"AllowFileSharingForGuestUsers":false, | |
"Classification":"IT", | |
"Description":"Here is my communication site", | |
// "SiteDesignId" - use either of the below 3 options | |
//"SiteDesignId":"f6cc5403-0d63-442e-96c0-285923709ffc", | |
//"SiteDesignId":null, | |
"SiteDesignId":"6142d2a0-63a5-4ba0-aede-d9fefca2c767", |
OlderNewer