Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
Expand Down Expand Up @@ -108,16 +109,16 @@ public void ExtractBaseTemplates2()

List<BaseTemplate> templates = new List<BaseTemplate>(15);
templates.Add(new BaseTemplate("STS#0"));
templates.Add(new BaseTemplate("BLOG#0"));
//templates.Add(new BaseTemplate("BLOG#0")); // Unable to create
templates.Add(new BaseTemplate("BDR#0"));
templates.Add(new BaseTemplate("DEV#0"));
templates.Add(new BaseTemplate("OFFILE#1"));
templates.Add(new BaseTemplate("GROUP#0", skipDeleteCreateCycle: true));
//templates.Add(new BaseTemplate("GROUP#0")); // Unable to create
templates.Add(new BaseTemplate("SITEPAGEPUBLISHING#0"));
templates.Add(new BaseTemplate("EHS#1"));
//templates.Add(new BaseTemplate("EHS#1")); // Unable to create
templates.Add(new BaseTemplate("BLANKINTERNETCONTAINER#0", "", "BLANKINTERNET#0"));
templates.Add(new BaseTemplate("STS#3"));
templates.Add(new BaseTemplate("BICENTERSITE#0"));
//templates.Add(new BaseTemplate("BICENTERSITE#0")); // Unable to create
templates.Add(new BaseTemplate("SRCHCEN#0"));
templates.Add(new BaseTemplate("BLANKINTERNETCONTAINER#0", "CMSPUBLISHING#0", "CMSPUBLISHING#0"));
templates.Add(new BaseTemplate("ENTERWIKI#0"));
Expand Down Expand Up @@ -161,7 +162,7 @@ private void ProcessBaseTemplates(List<BaseTemplate> templates, bool deleteSites

try
{
Console.WriteLine("Deleting existing site {0}", siteUrl);
Debug.WriteLine("Deleting existing site {0}", siteUrl);
if (template.SkipDeleteCreateCycle)
{
// Do nothing for the time being since we don't allow group deletion using app-only context
Expand All @@ -182,21 +183,21 @@ private void ProcessBaseTemplates(List<BaseTemplate> templates, bool deleteSites
{
string siteUrl = GetSiteUrl(template);

Console.WriteLine("Creating site {0}", siteUrl);
Debug.WriteLine("Creating site {0}", siteUrl);

if (template.SkipDeleteCreateCycle)
{
// Do nothing for the time being since we don't allow group creation using app-only context
}
else
{
bool siteExists = false;
SiteExistence siteExists = SiteExistence.No;
if (template.SubSiteTemplate.Length > 0)
{
siteExists = tenant.SiteExists(siteUrl);
siteExists = tenant.SiteExistsAnywhere(siteUrl);
}

if (!siteExists)
if (siteExists == SiteExistence.No)
{
if (template.Template.StartsWith("SITEPAGEPUBLISHING"))
{
Expand Down Expand Up @@ -259,6 +260,7 @@ private void ProcessBaseTemplates(List<BaseTemplate> templates, bool deleteSites
{
string siteUrl = GetSiteUrl(template, false);

Debug.WriteLine("Exporting site {0}", siteUrl);
// Export the base templates
using (ClientContext cc = ctx.Clone(siteUrl))
{
Expand Down
13 changes: 13 additions & 0 deletions src/lib/PnP.Framework.Test/TestCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,19 @@ private static ClientContext CreateContext(string contextUrl, AzureEnvironment a
using var am = AuthenticationManager.CreateWithCertificate(AzureADClientId, System.Security.Cryptography.X509Certificates.StoreName.My, System.Security.Cryptography.X509Certificates.StoreLocation.CurrentUser, AzureADCertificateThumbprint, TenantId);
context = am.GetContext(contextUrl);
}
else
{
// Delegated (user credentials) auth using the configured Azure AD client id
using (AuthenticationManager am = new AuthenticationManager(AzureADClientId, UserName, Password, null, azureEnvironment))
{
if (azureEnvironment == AzureEnvironment.Custom)
{
am.SetEndPointsForCustomAzureEnvironmentConfiguration(AppSetting("MicrosoftGraphEndPoint"), AppSetting("AzureADLoginEndPoint"));
}

context = am.GetContext(contextUrl);
}
}
}
else if (!String.IsNullOrEmpty(AppId) && !String.IsNullOrEmpty(AppSecret))
{
Expand Down
Loading
Loading