Last active
April 17, 2020 17:46
-
-
Save gautamdsheth/6cd4a8131a8606eb075ed89915e7c93e to your computer and use it in GitHub Desktop.
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 Microsoft.SharePoint.Client; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Security; | |
using System.Text; | |
using System.Threading.Tasks; | |
using ClientSidePage = OfficeDevPnP.Core.Pages.ClientSidePage; | |
namespace ConsoleApp1 | |
{ | |
class p3 | |
{ | |
static void Main(string[] args) | |
{ | |
string userName = "username"; | |
string password = "password"; | |
using (ClientContext clientContext = new ClientContext("https://<your-site-url>")) | |
{ | |
SecureString securePassword = new SecureString(); | |
foreach (char c in password.ToCharArray()) | |
{ | |
securePassword.AppendChar(c); | |
} | |
clientContext.AuthenticationMode = ClientAuthenticationMode.Default; | |
clientContext.Credentials = new SharePointOnlineCredentials(userName, securePassword); | |
// Load the template page | |
ClientSidePage page = clientContext.Web.LoadClientSidePage("Template/IT_Template.aspx"); | |
// Create and Save the modern page based on the template | |
page.Save("IT_Australia.aspx"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment