Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2006 from SharePoint/dev
Browse files Browse the repository at this point in the history
April 2019 Release
  • Loading branch information
erwinvanhunen committed Apr 5, 2019
2 parents 771c4f2 + edfd2e1 commit bbd4739
Show file tree
Hide file tree
Showing 42 changed files with 4,117 additions and 1,014 deletions.
Binary file modified Binaries/SharePointPnP.Modernization.Framework.dll
Binary file not shown.
1,709 changes: 1,350 additions & 359 deletions Binaries/SharePointPnP.Modernization.Framework.xml

Large diffs are not rendered by default.

Binary file modified Binaries/release/SharePointPnP.Modernization.Framework.dll
Binary file not shown.
1,709 changes: 1,350 additions & 359 deletions Binaries/release/SharePointPnP.Modernization.Framework.xml

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,30 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Added

- Added Sync-PnPAppToTeams to synchronize an app from the tenant app catalog to the Microsoft Teams App Catalog
- Added Export-PnPClientSidePageMapping to export the mapping files needed during publishing page transformation

### Changed

- Added a -Kerberos switch to Connect-PnPOnline to facility authentication using Kerberos
- Added the ability to set the view fields using Set-PnPView -Fields
- Added the ability to add and removed indexed property keys to lists
- Added the option to search by title on Get-PnPAlert
- Added -CreateTeam to New-PnPUnifiedGroup and Set-PnPUnifiedGroup
- Added -ContentType parameter to Add-PnPClientSidePage and Set-PnPClientSidePage
- ConvertTo-PnPClientSidePage: added -Library and -Folder parameters to support modernization of pages living outside of the SitePages folder
- ConvertTo-PnPClientSidePage: added -LogType, -LogFolder, -LogSkipFlush and -LogVerbose parameters to support log generation to an md file or SharePoint page
- ConvertTo-PnPClientSidePage: added -DontPublish and -DisablePageComments parameters to control the page publishing and commenting
- ConvertTo-PnPClientSidePage: added -PublishingPage and -PageLayoutMapping to support publishing page transformation

### Contributors

- Heinrich Ulbricht [heinrich-ulbricht]
- Gautam Sheth [gautamdsheth]
- Thomas Meckel [tmeckel]
- Jose Gabriel Ortega Castro [j0rt3g4]
- Fabian Seither [fabianseither]

## [3.7.1903.0]

### Added
Expand Down
16 changes: 14 additions & 2 deletions Commands/Admin/AddOffice365GroupToSite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using SharePointPnP.PowerShell.Commands.Base;
using System.Management.Automation;
using OfficeDevPnP.Core.Sites;
using SharePointPnP.PowerShell.Commands.Base.PipeBinds;

namespace SharePointPnP.PowerShell.Commands.Admin
{
Expand Down Expand Up @@ -39,18 +40,29 @@ public class AddOffice365GroupToSite: PnPAdminCmdlet
[Parameter(Mandatory = false, HelpMessage = @"Specifies if the current site home page is kept. Defaults to false.")]
public SwitchParameter KeepOldHomePage;

[Parameter(Mandatory = false, HelpMessage = "If specified the site will be associated to the hubsite as identified by this id")]
public GuidPipeBind HubSiteId;

[Parameter(Mandatory = false, HelpMessage = "The array UPN values of the group's owners.")]
public string[] Owners;
protected override void ExecuteCmdlet()
{
{
var groupifyInformation = new TeamSiteCollectionGroupifyInformation()
{
Alias = Alias,
DisplayName = DisplayName,
Description = Description,
Classification = Classification,
IsPublic = IsPublic,
KeepOldHomePage = KeepOldHomePage
KeepOldHomePage = KeepOldHomePage,
Owners = Owners
};

if (MyInvocation.BoundParameters.ContainsKey("HubSiteId"))
{
groupifyInformation.HubSiteId = HubSiteId.Id;
}

Tenant.GroupifySite(Url, groupifyInformation);
}
}
Expand Down
26 changes: 26 additions & 0 deletions Commands/Admin/GetHomeSite.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#if !ONPREMISES
using Microsoft.SharePoint.Client;
using SharePointPnP.PowerShell.CmdletHelpAttributes;
using SharePointPnP.PowerShell.Commands.Base;
using System.Management.Automation;

namespace SharePointPnP.PowerShell.Commands.Admin
{
[Cmdlet(VerbsCommon.Get, "PnPHomeSite")]
[CmdletHelp("Returns the home site url for your tenant",
SupportedPlatform = CmdletSupportedPlatform.Online,
Category = CmdletHelpCategory.TenantAdmin)]
[CmdletExample(
Code = @"PS:> Get-PnPHomeSite",
Remarks = @"Returns the home site url for your tenant", SortOrder = 1)]
public class GetHomeSite : PnPAdminCmdlet
{
protected override void ExecuteCmdlet()
{
var results = Tenant.GetSPHSiteUrl();
ClientContext.ExecuteQueryRetry();
WriteObject(results.Value);
}
}
}
#endif
21 changes: 14 additions & 7 deletions Commands/Admin/NewTenantSite.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System;
using System.Management.Automation;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client;
using OfficeDevPnP.Core;
#if ONPREMISES
using OfficeDevPnP.Core.Entities;
#endif
using SharePointPnP.PowerShell.CmdletHelpAttributes;
using SharePointPnP.PowerShell.Commands.Base;
using System;
using System.Management.Automation;
using Resources = SharePointPnP.PowerShell.Commands.Properties.Resources;


Expand All @@ -17,11 +19,11 @@ namespace SharePointPnP.PowerShell.Commands
Category = CmdletHelpCategory.TenantAdmin)]
[CmdletExample(
Code = @"PS:> New-PnPTenantSite -Title Contoso -Url https://tenant.sharepoint.com/sites/contoso -Owner user@example.org -TimeZone 4 -Template STS#0",
Remarks = @"This will add a site collection with the title 'Contoso', the url 'https://tenant.sharepoint.com/sites/contoso', the timezone 'UTC+01:00',the owner 'user@example.org' and the template used will be STS#0, a TeamSite",
Remarks = @"This will add a site collection with the title 'Contoso', the url 'https://tenant.sharepoint.com/sites/contoso', the timezone 'UTC+01:00',the owner 'user@example.org' and the template used will be STS#0, a TeamSite",
SortOrder = 1)]
[CmdletExample(
Code = @"PS:> New-PnPTenantSite -Title Contoso -Url /sites/contososite -Owner user@example.org -TimeZone 4 -Template STS#0",
Remarks = @"This will add a site collection with the title 'Contoso', the url 'https://tenant.sharepoint.com/sites/contososite' of which the base part will be picked up from your current connection, the timezone 'UTC+01:00', the owner 'user@example.org' and the template used will be STS#0, a TeamSite",
Remarks = @"This will add a site collection with the title 'Contoso', the url 'https://tenant.sharepoint.com/sites/contososite' of which the base part will be picked up from your current connection, the timezone 'UTC+01:00', the owner 'user@example.org' and the template used will be STS#0, a TeamSite",
SortOrder = 2)]
[CmdletRelatedLink(
Text = "Locale IDs",
Expand All @@ -40,7 +42,8 @@ public class NewTenantSite : PnPAdminCmdlet
[Parameter(Mandatory = true, HelpMessage = @"Specifies the full URL of the new site collection. It must be in a valid managed path in the company's site. For example, for company contoso, valid managed paths are https://contoso.sharepoint.com/sites and https://contoso.sharepoint.com/teams.")]
public string Url;

[Parameter(Mandatory = false, HelpMessage = @"Specifies the description of the new site collection")]
[Obsolete("This parameter is currently ignored due to server side API issues when setting this value.")]
[Parameter(Mandatory = false, HelpMessage = @"Specifies the description of the new site collection. Setting a value for this parameter will override the Wait parameter as we have to set the description after the site has been created.")]
public string Description = string.Empty;

[Parameter(Mandatory = true, HelpMessage = @"Specifies the user name of the site collection's primary owner. The owner must be a user instead of a security group or an email-enabled security group.")]
Expand Down Expand Up @@ -103,11 +106,15 @@ protected override void ExecuteCmdlet()
entity.UserCodeMaximumLevel = ResourceQuota;
entity.UserCodeWarningLevel = ResourceQuotaWarningLevel;
entity.Lcid = Lcid;

Tenant.CreateSiteCollection(entity);
#else
Func<TenantOperationMessage, bool> timeoutFunction = TimeoutFunction;

if (MyInvocation.BoundParameters.ContainsKey("Description"))
{
// We have to fall back to synchronous behaviour as we have to wait for the site to be present in order to set the description.
Wait = true;
}

Tenant.CreateSiteCollection(Url, Title, Owner, Template, (int)StorageQuota,
(int)StorageQuotaWarningLevel, TimeZone, (int)ResourceQuota, (int)ResourceQuotaWarningLevel, Lcid,
Expand Down
40 changes: 40 additions & 0 deletions Commands/Admin/RemoveHomeSite.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#if !ONPREMISES
using Microsoft.SharePoint.Client;
using SharePointPnP.PowerShell.CmdletHelpAttributes;
using SharePointPnP.PowerShell.Commands.Base;
using System.Management.Automation;

namespace SharePointPnP.PowerShell.Commands.Admin
{
[Cmdlet(VerbsCommon.Remove, "PnPHomeSite")]
[CmdletHelp("Removes the currently set site as the home site",
SupportedPlatform = CmdletSupportedPlatform.Online,
Category = CmdletHelpCategory.TenantAdmin)]
[CmdletExample(
Code = @"PS:> Remove-PnPHomeSite",
Remarks = @"Removes the currently set site as the home site", SortOrder = 1)]
public class RemoveHomeSite : PnPAdminCmdlet
{
[Parameter(Mandatory = false, HelpMessage = "Specifying the Force parameter will skip the confirmation question.")]
public SwitchParameter Force;

protected override void ExecuteCmdlet()
{
var homesiteUrl = Tenant.GetSPHSiteUrl();
ClientContext.ExecuteQueryRetry();
if (!string.IsNullOrEmpty(homesiteUrl.Value))
{
if (Force || ShouldContinue($"Remove {homesiteUrl.Value} as the home site?", Properties.Resources.Confirm))
{
Tenant.RemoveSPHSite();
ClientContext.ExecuteQueryRetry();
}
}
else
{
WriteWarning("There is currently not site collection set as a home site in your tenant.");
}
}
}
}
#endif
28 changes: 28 additions & 0 deletions Commands/Admin/SetHomeSite.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#if !ONPREMISES
using Microsoft.SharePoint.Client;
using SharePointPnP.PowerShell.CmdletHelpAttributes;
using SharePointPnP.PowerShell.Commands.Base;
using System.Management.Automation;

namespace SharePointPnP.PowerShell.Commands.Admin
{
[Cmdlet(VerbsCommon.Set, "PnPHomeSite")]
[CmdletHelp("Sets the home site for your tenant",
SupportedPlatform = CmdletSupportedPlatform.Online,
Category = CmdletHelpCategory.TenantAdmin)]
[CmdletExample(
Code = @"PS:> Set-PnPHomeSite -Url https://yourtenant.sharepoint.com/sites/myhome",
Remarks = @"Sets the home site to the provided site collection url", SortOrder = 1)]
public class SetHomeSite : PnPAdminCmdlet
{
[Parameter(Mandatory = true, HelpMessage = "The url of the site to set as the home site")]
public string Url;

protected override void ExecuteCmdlet()
{
Tenant.SetSPHSite(Url);
ClientContext.ExecuteQueryRetry();
}
}
}
#endif
38 changes: 38 additions & 0 deletions Commands/Apps/SyncAppToTeams.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#if !ONPREMISES
using OfficeDevPnP.Core.Enums;
using SharePointPnP.PowerShell.CmdletHelpAttributes;
using SharePointPnP.PowerShell.Commands.Base.PipeBinds;
using System;
using System.Management.Automation;

namespace SharePointPnP.PowerShell.Commands.Apps
{
[Cmdlet(VerbsData.Sync, "PnPAppToTeams")]
[CmdletHelp("Synchronize an app from the tenant app catalog to the Microsoft Teams app catalog", SupportedPlatform = CmdletSupportedPlatform.Online,
Category = CmdletHelpCategory.Apps)]
[CmdletExample(
Code = @"PS:> Sync-PnPAppToTeams -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe",
Remarks = @"This will synchronize the given app with the Microsoft Teams app catalog", SortOrder = 1)]
public class SyncAppToTeams : PnPCmdlet
{
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, HelpMessage = "Specifies the Id of the Addin Instance")]
public AppMetadataPipeBind Identity;

protected override void ExecuteCmdlet()
{
var manager = new OfficeDevPnP.Core.ALM.AppManager(ClientContext);

var app = Identity.GetAppMetadata(ClientContext, AppCatalogScope.Tenant);

if (app != null)
{
manager.SyncToTeams(app);
}
else
{
throw new Exception("Cannot find app");
}
}
}
}
#endif
30 changes: 22 additions & 8 deletions Commands/Base/ConnectOnline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace SharePointPnP.PowerShell.Commands.Base
{
[Cmdlet(VerbsCommunications.Connect, "PnPOnline", SupportsShouldProcess = false)]
[CmdletHelp("Connect to a SharePoint site",
@"Connects to a SharePoint site and creates a context that is required for the other PnP Cmdlets.
@"Connects to a SharePoint site and creates a context that is required for the other PnP Cmdlets.
To automate authentication there are several options. The easiest would be to use the Windows Credential Manager. Either manually add a Generic Credential, or use the Add-PnPStoredCredential cmdlet to add an entry. The name you give to the credential can be used in two main ways. If you simply give it a name alike 'O365' or any other value you can specify this value for the Credentials parameter of this cmdlet.
Alternatively you can specify a URL as a name, alike 'https://contoso.sharepoint.com'. Any site you connect to within the contoso tenant will then use the credentials you specified. For more information see the help for the Add-PnPStoredCredential cmdlet. (Get-Help Add-PnPStoredCredential).
Expand Down Expand Up @@ -191,6 +191,9 @@ public class ConnectOnline : PSCmdlet
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_MAIN, HelpMessage = "If you want to connect to your on-premises SharePoint farm using ADFS")]
public SwitchParameter UseAdfs;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_MAIN, HelpMessage = "Authenticate using Kerberos to an on-premises ADFS instance.")]
public SwitchParameter Kerberos;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_MAIN, HelpMessage = "The name of the ADFS trusted login provider")]
public string LoginProviderName;

Expand Down Expand Up @@ -316,8 +319,8 @@ public class ConnectOnline : PSCmdlet
public SwitchParameter SPOManagementShell;


[Parameter(Mandatory = true, ParameterSetName = ParameterSet_DEVICELOGIN, HelpMessage = @"Log in using the PnP O365 Management Shell application. You will be asked to consent to:
[Parameter(Mandatory = true, ParameterSetName = ParameterSet_DEVICELOGIN, HelpMessage = @"Log in using the PnP O365 Management Shell application. You will be asked to consent to:
* Read and write managed metadata
* Have full control of all site collections
* Read user profiles
Expand All @@ -333,7 +336,7 @@ public class ConnectOnline : PSCmdlet
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_GRAPHDEVICELOGIN, HelpMessage = "Launch a browser automatically and copy the code to enter to the clipboard")]
public SwitchParameter LaunchBrowser;

[Parameter(Mandatory = true, ParameterSetName = ParameterSet_GRAPHDEVICELOGIN, HelpMessage = @"Log in using the PnP O365 Management Shell application towards the Graph. You will be asked to consent to:
[Parameter(Mandatory = true, ParameterSetName = ParameterSet_GRAPHDEVICELOGIN, HelpMessage = @"Log in using the PnP O365 Management Shell application towards the Graph. You will be asked to consent to:
* Read and write managed metadata
* Have full control of all site collections
Expand Down Expand Up @@ -497,21 +500,32 @@ protected override void ProcessRecord()
#if !NETSTANDARD2_0
connection = SPOnlineConnectionHelper.InstantiateWebloginConnection(new Uri(Url), MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, Host, SkipTenantAdminCheck);
#else
WriteWarning(@"-UseWebLogin is not implemented, due to restrictions of the .NET Standard framework.
WriteWarning(@"-UseWebLogin is not implemented, due to restrictions of the .NET Standard framework.
Use -PnPO365ManagementShell instead");
#endif
}
else if (UseAdfs)
{
if (creds == null)
if (!Kerberos && creds == null)
{
if ((creds = GetCredentials()) == null)
{
creds = Host.UI.PromptForCredential(Properties.Resources.EnterYourCredentials, "", "", "");
}
}
#if !NETSTANDARD2_0
connection = SPOnlineConnectionHelper.InstantiateAdfsConnection(new Uri(Url), creds, Host, MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, NoTelemetry, SkipTenantAdminCheck, LoginProviderName);
connection = SPOnlineConnectionHelper.InstantiateAdfsConnection(new Uri(Url),
Kerberos,
creds,
Host,
MinimalHealthScore,
RetryCount,
RetryWait,
RequestTimeout,
TenantAdminUrl,
NoTelemetry,
SkipTenantAdminCheck,
LoginProviderName);
#else
throw new NotImplementedException();
#endif
Expand Down Expand Up @@ -765,7 +779,7 @@ private SPOnlineConnection ConnectGraphDeviceLogin(string accessToken)
}
}


private void ConnectGraphAAD()
{
var appCredentials = new ClientCredential(AppSecret);
Expand Down
Loading

0 comments on commit bbd4739

Please sign in to comment.