Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/officedev/pnp into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
VesaJuvonen committed Feb 6, 2015
2 parents e890301 + f7746b1 commit 0c90f66
Show file tree
Hide file tree
Showing 296 changed files with 6,393 additions and 2,331 deletions.
Binary file modified Binaries/PowerShell.Commands/PnPPowerShellCommands15.msi
Binary file not shown.
Binary file modified Binaries/PowerShell.Commands/PnPPowerShellCommands16.msi
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,23 @@ public void Initialize()
wci1.Title = testWebName;
wci1.WebTemplate = "CMSPUBLISHING#0";
var web1 = context.Web.Webs.Add(wci1);
context.ExecuteQuery();
context.ExecuteQueryRetry();
web1.ActivateFeature(new Guid("41E1D4BF-B1A2-47F7-AB80-D5D6CBBA3092"));

var wci2 = new WebCreationInformation();
wci2.Url = "a";
wci2.Title = "A";
wci2.WebTemplate = "CMSPUBLISHING#0";
var webA = web1.Webs.Add(wci2);
context.ExecuteQuery();
context.ExecuteQueryRetry();
webA.ActivateFeature(new Guid("41E1D4BF-B1A2-47F7-AB80-D5D6CBBA3092"));

var wci3 = new WebCreationInformation();
wci3.Url = "b";
wci3.Title = "B";
wci3.WebTemplate = "CMSPUBLISHING#0";
var webB = web1.Webs.Add(wci3);
context.ExecuteQuery();
context.ExecuteQueryRetry();
webB.ActivateFeature(new Guid("41E1D4BF-B1A2-47F7-AB80-D5D6CBBA3092"));
}

Expand Down Expand Up @@ -129,14 +129,14 @@ public void CleanUp()
query.ViewXml = camlString;
var found = themeGallery.GetItems(query);
web.Context.Load(found);
web.Context.ExecuteQuery();
web.Context.ExecuteQueryRetry();
Console.WriteLine("{0} matching looks found to delete", found.Count);
var looksToDelete = found.ToList();
foreach (var item in looksToDelete)
{
Console.WriteLine("Delete look item '{0}'", item["Name"]);
item.DeleteObject();
context.ExecuteQuery();
context.ExecuteQueryRetry();
}

// Remove Theme Files
Expand All @@ -145,15 +145,15 @@ public void CleanUp()
FolderCollection rootFolders = rootFolder.Folders;
web.Context.Load(rootFolder);
web.Context.Load(rootFolders, f => f.Where(folder => folder.Name == "15"));
web.Context.ExecuteQuery();
web.Context.ExecuteQueryRetry();

Folder folder15 = rootFolders.FirstOrDefault();

try
{
Microsoft.SharePoint.Client.File customColorFile = folder15.Files.GetByUrl("custom.spcolor");
customColorFile.DeleteObject();
context.ExecuteQuery();
context.ExecuteQueryRetry();
}
catch (Exception ex)
{
Expand All @@ -164,7 +164,7 @@ public void CleanUp()
{
Microsoft.SharePoint.Client.File customBackgroundFile = folder15.Files.GetByUrl("custombg.jpg");
customBackgroundFile.DeleteObject();
context.ExecuteQuery();
context.ExecuteQueryRetry();
}
catch (Exception ex)
{
Expand All @@ -174,21 +174,21 @@ public void CleanUp()
// Remove webs
var webCollection1 = web.Webs;
context.Load(webCollection1, wc => wc.Include(w => w.Title, w => w.ServerRelativeUrl));
context.ExecuteQuery();
context.ExecuteQueryRetry();
var websToDelete = new List<Web>();
foreach (var web1 in webCollection1)
{
if (web1.Title.StartsWith("Test_"))
{
var webCollection2 = web1.Webs;
context.Load(webCollection2, wc => wc.Include(w => w.Title, w => w.ServerRelativeUrl));
context.ExecuteQuery();
context.ExecuteQueryRetry();
var childrenToDelete = new List<Web>(webCollection2);
foreach (var web2 in childrenToDelete)
{
Console.WriteLine("Deleting site {0}", web2.ServerRelativeUrl);
web2.DeleteObject();
context.ExecuteQuery();
context.ExecuteQueryRetry();
}
websToDelete.Add(web1);
}
Expand All @@ -200,7 +200,7 @@ public void CleanUp()
web1.DeleteObject();
try
{
context.ExecuteQuery();
context.ExecuteQueryRetry();
}
catch (Exception ex)
{
Expand All @@ -212,23 +212,23 @@ public void CleanUp()
List masterPageGallery = context.Web.GetCatalog((int)ListTemplateType.MasterPageCatalog);
Folder rootFolderInMasterPageGallery = masterPageGallery.RootFolder;
context.Load(rootFolderInMasterPageGallery, f => f.ServerRelativeUrl);
context.ExecuteQuery();
context.ExecuteQueryRetry();

try
{
var fileServerRelativeUrl = UrlUtility.Combine(rootFolderInMasterPageGallery.ServerRelativeUrl, publishingPageWithoutExtension);
var file = context.Web.GetFileByServerRelativeUrl(String.Format("{0}.aspx", fileServerRelativeUrl));
context.Load(file);
context.ExecuteQuery();
context.ExecuteQueryRetry();
file.DeleteObject();
context.ExecuteQuery();
context.ExecuteQueryRetry();

fileServerRelativeUrl = UrlUtility.Combine(rootFolderInMasterPageGallery.ServerRelativeUrl, "test/test", publishingPageWithoutExtension);
file = context.Web.GetFileByServerRelativeUrl(String.Format("{0}.aspx", fileServerRelativeUrl));
context.Load(file);
context.ExecuteQuery();
context.ExecuteQueryRetry();
file.DeleteObject();
context.ExecuteQuery();
context.ExecuteQueryRetry();
}
catch (Exception ex)
{
Expand Down Expand Up @@ -288,7 +288,7 @@ public void CanUploadHtmlPageLayoutAndConvertItToAspxVersionTest()
web.Context.Load(web);
web.DeployHtmlPageLayout(htmlPublishingPagePath, pageLayoutTitle, "", welcomePageContentTypeId);
web.Context.Load(web, w => w.ServerRelativeUrl);
web.Context.ExecuteQuery();
web.Context.ExecuteQueryRetry();
var item = web.GetPageLayoutListItemByName(htmlPublishingPageWithoutExtension);
Assert.AreNotEqual(null, item);
}
Expand All @@ -300,7 +300,7 @@ public void CanUploadPageLayoutTest()
web.Context.Load(web);
web.DeployPageLayout(publishingPagePath, pageLayoutTitle, "", welcomePageContentTypeId);
web.Context.Load(web, w => w.ServerRelativeUrl);
web.Context.ExecuteQuery();
web.Context.ExecuteQueryRetry();
var item = web.GetPageLayoutListItemByName(publishingPageWithoutExtension);
Assert.AreNotEqual(null, item);
}
Expand All @@ -312,7 +312,7 @@ public void CanUploadPageLayoutWithPathTest()
web.Context.Load(web);
web.DeployPageLayout(publishingPagePath, pageLayoutTitle, "", welcomePageContentTypeId, "test/test");
web.Context.Load(web, w => w.ServerRelativeUrl);
web.Context.ExecuteQuery();
web.Context.ExecuteQueryRetry();
var item = web.GetPageLayoutListItemByName("test/test/" + publishingPageWithoutExtension);
Assert.AreNotEqual(null, item);
}
Expand Down Expand Up @@ -379,7 +379,7 @@ public void CreateComposedLookShouldWorkTest()
using (var context = TestCommon.CreateClientContext())
{
context.Load(context.Web, w => w.ServerRelativeUrl);
context.ExecuteQuery();
context.ExecuteQueryRetry();
var paletteServerRelativeUrl = context.Web.ServerRelativeUrl + "/_catalog/theme/15" + builtInPalette003;
var masterServerRelativeUrl = context.Web.ServerRelativeUrl + "/_catalog/masterpage" + builtInMasterOslo;

Expand All @@ -393,7 +393,7 @@ public void CreateComposedLookShouldWorkTest()
query.ViewXml = string.Format(CAML_QUERY_FIND_BY_FILENAME, testLookName);
var existingCollection = composedLooksList.GetItems(query);
context.Load(existingCollection);
context.ExecuteQuery();
context.ExecuteQueryRetry();
var item = existingCollection.FirstOrDefault();

var lookPaletteUrl = item["ThemeUrl"] as FieldUrlValue;
Expand Down Expand Up @@ -423,7 +423,7 @@ public void CreateComposedLookByNameShouldWorkTest()
query.ViewXml = string.Format(CAML_QUERY_FIND_BY_FILENAME, testLookName);
var existingCollection = composedLooksList.GetItems(query);
context.Load(existingCollection);
context.ExecuteQuery();
context.ExecuteQueryRetry();
var item = existingCollection.FirstOrDefault();

var lookPaletteUrl = item["ThemeUrl"] as FieldUrlValue;
Expand All @@ -440,12 +440,12 @@ public void SetComposedLookInheritsTest()
{
var webCollection = context.Web.Webs;
context.Load(webCollection, wc => wc.Include(w => w.Title));
context.ExecuteQuery();
context.ExecuteQueryRetry();
var webToChange1 = webCollection.First(w => w.Title == testWebName);

var webCollection2 = webToChange1.Webs;
context.Load(webCollection2, wc => wc.Include(w => w.Title));
context.ExecuteQuery();
context.ExecuteQueryRetry();
var webToChangeA = webCollection2.First(w => w.Title == "A");

// Act
Expand All @@ -457,18 +457,18 @@ public void SetComposedLookInheritsTest()
{
var webCollection = context.Web.Webs;
context.Load(webCollection, wc => wc.Include(w => w.Title));
context.ExecuteQuery();
context.ExecuteQueryRetry();
var webToCheck1 = webCollection.First(w => w.Title == testWebName);

var webCollection2 = webToCheck1.Webs;
context.Load(webCollection2, wc => wc.Include(w => w.Title, w => w.MasterUrl, w => w.CustomMasterUrl));
context.ExecuteQuery();
context.ExecuteQueryRetry();

var webToCheckB = webCollection2.First(w => w.Title == "B");
var webToCheckA = webCollection2.First(w => w.Title == "A");
var accentTextB = webToCheckB.ThemeInfo.GetThemeShadeByName("AccentText");
var accentTextA = webToCheckA.ThemeInfo.GetThemeShadeByName("AccentText");
context.ExecuteQuery();
context.ExecuteQueryRetry();

// Assert: B will have new style, A will have Inherit = false and not get the new style

Expand All @@ -489,12 +489,12 @@ public void SetComposedLookResetInheritanceTest()
{
var webCollection = context.Web.Webs;
context.Load(webCollection, wc => wc.Include(w => w.Title));
context.ExecuteQuery();
context.ExecuteQueryRetry();
var webToChange1 = webCollection.First(w => w.Title == testWebName);

var webCollection2 = webToChange1.Webs;
context.Load(webCollection2, wc => wc.Include(w => w.Title));
context.ExecuteQuery();
context.ExecuteQueryRetry();
var webToChangeA = webCollection2.First(w => w.Title == "A");

// Act
Expand All @@ -506,15 +506,15 @@ public void SetComposedLookResetInheritanceTest()
{
var webCollection = context.Web.Webs;
context.Load(webCollection, wc => wc.Include(w => w.Title));
context.ExecuteQuery();
context.ExecuteQueryRetry();
var webToCheck1 = webCollection.First(w => w.Title == testWebName);

var webCollection2 = webToCheck1.Webs;
context.Load(webCollection2, wc => wc.Include(w => w.Title, w => w.MasterUrl, w => w.CustomMasterUrl));
context.ExecuteQuery();
context.ExecuteQueryRetry();
var webToCheckA = webCollection2.First(w => w.Title == "A");
var accentA = webToCheckA.ThemeInfo.GetThemeShadeByName("AccentText");
context.ExecuteQuery();
context.ExecuteQueryRetry();

// Assert: B will have Inherit = false and not get the new style, A will hav new style

Expand All @@ -535,7 +535,7 @@ public void SeattleMasterPageIsUnchangedTest()
var web = context.Web;
//need to get the server relative url
context.Load(web, w => w.ServerRelativeUrl);
context.ExecuteQuery();
context.ExecuteQueryRetry();
//Use the existing context to directly get a copy of the seattle master page
string masterpageGalleryServerRelativeUrl = UrlUtility.Combine(UrlUtility.EnsureTrailingSlash(web.ServerRelativeUrl), "_catalogs/masterpage/");
var serverRelativeUrlOfSeattle = UrlUtility.Combine(masterpageGalleryServerRelativeUrl, builtInMasterSeattle);
Expand All @@ -544,13 +544,13 @@ public void SeattleMasterPageIsUnchangedTest()
//FileInformation seattle = Microsoft.SharePoint.Client.File.OpenBinaryDirect(context, serverRelativeUrlOfSeattle);
var seattle = context.Web.GetFileByServerRelativeUrl(serverRelativeUrlOfSeattle);
web.Context.Load(seattle);
web.Context.ExecuteQuery();
web.Context.ExecuteQueryRetry();

Assert.IsNotNull(seattle);

ClientResult<Stream> data = seattle.OpenBinaryStream();
context.Load(seattle);
context.ExecuteQuery();
context.ExecuteQueryRetry();

//Dump seattle.master
//if (data != null)
Expand Down
Loading

0 comments on commit 0c90f66

Please sign in to comment.