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

Commit bbd4739

Browse files
Merge pull request #2006 from SharePoint/dev
April 2019 Release
2 parents 771c4f2 + edfd2e1 commit bbd4739

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+4117
-1014
lines changed
Binary file not shown.

Binaries/SharePointPnP.Modernization.Framework.xml

+1,350-359
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

Binaries/release/SharePointPnP.Modernization.Framework.xml

+1,350-359
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

+20
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,30 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
99

1010
### Added
1111

12+
- Added Sync-PnPAppToTeams to synchronize an app from the tenant app catalog to the Microsoft Teams App Catalog
13+
- Added Export-PnPClientSidePageMapping to export the mapping files needed during publishing page transformation
14+
1215
### Changed
1316

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

30+
- Heinrich Ulbricht [heinrich-ulbricht]
31+
- Gautam Sheth [gautamdsheth]
32+
- Thomas Meckel [tmeckel]
33+
- Jose Gabriel Ortega Castro [j0rt3g4]
34+
- Fabian Seither [fabianseither]
35+
1636
## [3.7.1903.0]
1737

1838
### Added

Commands/Admin/AddOffice365GroupToSite.cs

+14-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using SharePointPnP.PowerShell.Commands.Base;
66
using System.Management.Automation;
77
using OfficeDevPnP.Core.Sites;
8+
using SharePointPnP.PowerShell.Commands.Base.PipeBinds;
89

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

43+
[Parameter(Mandatory = false, HelpMessage = "If specified the site will be associated to the hubsite as identified by this id")]
44+
public GuidPipeBind HubSiteId;
45+
46+
[Parameter(Mandatory = false, HelpMessage = "The array UPN values of the group's owners.")]
47+
public string[] Owners;
4248
protected override void ExecuteCmdlet()
43-
{
49+
{
4450
var groupifyInformation = new TeamSiteCollectionGroupifyInformation()
4551
{
4652
Alias = Alias,
4753
DisplayName = DisplayName,
4854
Description = Description,
4955
Classification = Classification,
5056
IsPublic = IsPublic,
51-
KeepOldHomePage = KeepOldHomePage
57+
KeepOldHomePage = KeepOldHomePage,
58+
Owners = Owners
5259
};
5360

61+
if (MyInvocation.BoundParameters.ContainsKey("HubSiteId"))
62+
{
63+
groupifyInformation.HubSiteId = HubSiteId.Id;
64+
}
65+
5466
Tenant.GroupifySite(Url, groupifyInformation);
5567
}
5668
}

Commands/Admin/GetHomeSite.cs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#if !ONPREMISES
2+
using Microsoft.SharePoint.Client;
3+
using SharePointPnP.PowerShell.CmdletHelpAttributes;
4+
using SharePointPnP.PowerShell.Commands.Base;
5+
using System.Management.Automation;
6+
7+
namespace SharePointPnP.PowerShell.Commands.Admin
8+
{
9+
[Cmdlet(VerbsCommon.Get, "PnPHomeSite")]
10+
[CmdletHelp("Returns the home site url for your tenant",
11+
SupportedPlatform = CmdletSupportedPlatform.Online,
12+
Category = CmdletHelpCategory.TenantAdmin)]
13+
[CmdletExample(
14+
Code = @"PS:> Get-PnPHomeSite",
15+
Remarks = @"Returns the home site url for your tenant", SortOrder = 1)]
16+
public class GetHomeSite : PnPAdminCmdlet
17+
{
18+
protected override void ExecuteCmdlet()
19+
{
20+
var results = Tenant.GetSPHSiteUrl();
21+
ClientContext.ExecuteQueryRetry();
22+
WriteObject(results.Value);
23+
}
24+
}
25+
}
26+
#endif

Commands/Admin/NewTenantSite.cs

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
using System;
2-
using System.Management.Automation;
3-
using Microsoft.SharePoint.Client;
1+
using Microsoft.SharePoint.Client;
42
using OfficeDevPnP.Core;
3+
#if ONPREMISES
54
using OfficeDevPnP.Core.Entities;
5+
#endif
66
using SharePointPnP.PowerShell.CmdletHelpAttributes;
77
using SharePointPnP.PowerShell.Commands.Base;
8+
using System;
9+
using System.Management.Automation;
810
using Resources = SharePointPnP.PowerShell.Commands.Properties.Resources;
911

1012

@@ -17,11 +19,11 @@ namespace SharePointPnP.PowerShell.Commands
1719
Category = CmdletHelpCategory.TenantAdmin)]
1820
[CmdletExample(
1921
Code = @"PS:> New-PnPTenantSite -Title Contoso -Url https://tenant.sharepoint.com/sites/contoso -Owner [email protected] -TimeZone 4 -Template STS#0",
20-
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 '[email protected]' and the template used will be STS#0, a TeamSite",
22+
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 '[email protected]' and the template used will be STS#0, a TeamSite",
2123
SortOrder = 1)]
2224
[CmdletExample(
2325
Code = @"PS:> New-PnPTenantSite -Title Contoso -Url /sites/contososite -Owner [email protected] -TimeZone 4 -Template STS#0",
24-
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 '[email protected]' and the template used will be STS#0, a TeamSite",
26+
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 '[email protected]' and the template used will be STS#0, a TeamSite",
2527
SortOrder = 2)]
2628
[CmdletRelatedLink(
2729
Text = "Locale IDs",
@@ -40,7 +42,8 @@ public class NewTenantSite : PnPAdminCmdlet
4042
[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.")]
4143
public string Url;
4244

43-
[Parameter(Mandatory = false, HelpMessage = @"Specifies the description of the new site collection")]
45+
[Obsolete("This parameter is currently ignored due to server side API issues when setting this value.")]
46+
[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.")]
4447
public string Description = string.Empty;
4548

4649
[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.")]
@@ -103,11 +106,15 @@ protected override void ExecuteCmdlet()
103106
entity.UserCodeMaximumLevel = ResourceQuota;
104107
entity.UserCodeWarningLevel = ResourceQuotaWarningLevel;
105108
entity.Lcid = Lcid;
106-
107109
Tenant.CreateSiteCollection(entity);
108110
#else
109111
Func<TenantOperationMessage, bool> timeoutFunction = TimeoutFunction;
110112

113+
if (MyInvocation.BoundParameters.ContainsKey("Description"))
114+
{
115+
// 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.
116+
Wait = true;
117+
}
111118

112119
Tenant.CreateSiteCollection(Url, Title, Owner, Template, (int)StorageQuota,
113120
(int)StorageQuotaWarningLevel, TimeZone, (int)ResourceQuota, (int)ResourceQuotaWarningLevel, Lcid,

Commands/Admin/RemoveHomeSite.cs

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#if !ONPREMISES
2+
using Microsoft.SharePoint.Client;
3+
using SharePointPnP.PowerShell.CmdletHelpAttributes;
4+
using SharePointPnP.PowerShell.Commands.Base;
5+
using System.Management.Automation;
6+
7+
namespace SharePointPnP.PowerShell.Commands.Admin
8+
{
9+
[Cmdlet(VerbsCommon.Remove, "PnPHomeSite")]
10+
[CmdletHelp("Removes the currently set site as the home site",
11+
SupportedPlatform = CmdletSupportedPlatform.Online,
12+
Category = CmdletHelpCategory.TenantAdmin)]
13+
[CmdletExample(
14+
Code = @"PS:> Remove-PnPHomeSite",
15+
Remarks = @"Removes the currently set site as the home site", SortOrder = 1)]
16+
public class RemoveHomeSite : PnPAdminCmdlet
17+
{
18+
[Parameter(Mandatory = false, HelpMessage = "Specifying the Force parameter will skip the confirmation question.")]
19+
public SwitchParameter Force;
20+
21+
protected override void ExecuteCmdlet()
22+
{
23+
var homesiteUrl = Tenant.GetSPHSiteUrl();
24+
ClientContext.ExecuteQueryRetry();
25+
if (!string.IsNullOrEmpty(homesiteUrl.Value))
26+
{
27+
if (Force || ShouldContinue($"Remove {homesiteUrl.Value} as the home site?", Properties.Resources.Confirm))
28+
{
29+
Tenant.RemoveSPHSite();
30+
ClientContext.ExecuteQueryRetry();
31+
}
32+
}
33+
else
34+
{
35+
WriteWarning("There is currently not site collection set as a home site in your tenant.");
36+
}
37+
}
38+
}
39+
}
40+
#endif

Commands/Admin/SetHomeSite.cs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#if !ONPREMISES
2+
using Microsoft.SharePoint.Client;
3+
using SharePointPnP.PowerShell.CmdletHelpAttributes;
4+
using SharePointPnP.PowerShell.Commands.Base;
5+
using System.Management.Automation;
6+
7+
namespace SharePointPnP.PowerShell.Commands.Admin
8+
{
9+
[Cmdlet(VerbsCommon.Set, "PnPHomeSite")]
10+
[CmdletHelp("Sets the home site for your tenant",
11+
SupportedPlatform = CmdletSupportedPlatform.Online,
12+
Category = CmdletHelpCategory.TenantAdmin)]
13+
[CmdletExample(
14+
Code = @"PS:> Set-PnPHomeSite -Url https://yourtenant.sharepoint.com/sites/myhome",
15+
Remarks = @"Sets the home site to the provided site collection url", SortOrder = 1)]
16+
public class SetHomeSite : PnPAdminCmdlet
17+
{
18+
[Parameter(Mandatory = true, HelpMessage = "The url of the site to set as the home site")]
19+
public string Url;
20+
21+
protected override void ExecuteCmdlet()
22+
{
23+
Tenant.SetSPHSite(Url);
24+
ClientContext.ExecuteQueryRetry();
25+
}
26+
}
27+
}
28+
#endif

Commands/Apps/SyncAppToTeams.cs

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#if !ONPREMISES
2+
using OfficeDevPnP.Core.Enums;
3+
using SharePointPnP.PowerShell.CmdletHelpAttributes;
4+
using SharePointPnP.PowerShell.Commands.Base.PipeBinds;
5+
using System;
6+
using System.Management.Automation;
7+
8+
namespace SharePointPnP.PowerShell.Commands.Apps
9+
{
10+
[Cmdlet(VerbsData.Sync, "PnPAppToTeams")]
11+
[CmdletHelp("Synchronize an app from the tenant app catalog to the Microsoft Teams app catalog", SupportedPlatform = CmdletSupportedPlatform.Online,
12+
Category = CmdletHelpCategory.Apps)]
13+
[CmdletExample(
14+
Code = @"PS:> Sync-PnPAppToTeams -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe",
15+
Remarks = @"This will synchronize the given app with the Microsoft Teams app catalog", SortOrder = 1)]
16+
public class SyncAppToTeams : PnPCmdlet
17+
{
18+
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, HelpMessage = "Specifies the Id of the Addin Instance")]
19+
public AppMetadataPipeBind Identity;
20+
21+
protected override void ExecuteCmdlet()
22+
{
23+
var manager = new OfficeDevPnP.Core.ALM.AppManager(ClientContext);
24+
25+
var app = Identity.GetAppMetadata(ClientContext, AppCatalogScope.Tenant);
26+
27+
if (app != null)
28+
{
29+
manager.SyncToTeams(app);
30+
}
31+
else
32+
{
33+
throw new Exception("Cannot find app");
34+
}
35+
}
36+
}
37+
}
38+
#endif

Commands/Base/ConnectOnline.cs

+22-8
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace SharePointPnP.PowerShell.Commands.Base
2323
{
2424
[Cmdlet(VerbsCommunications.Connect, "PnPOnline", SupportsShouldProcess = false)]
2525
[CmdletHelp("Connect to a SharePoint site",
26-
@"Connects to a SharePoint site and creates a context that is required for the other PnP Cmdlets.
26+
@"Connects to a SharePoint site and creates a context that is required for the other PnP Cmdlets.
2727
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.
2828
2929
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).
@@ -191,6 +191,9 @@ public class ConnectOnline : PSCmdlet
191191
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_MAIN, HelpMessage = "If you want to connect to your on-premises SharePoint farm using ADFS")]
192192
public SwitchParameter UseAdfs;
193193

194+
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_MAIN, HelpMessage = "Authenticate using Kerberos to an on-premises ADFS instance.")]
195+
public SwitchParameter Kerberos;
196+
194197
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_MAIN, HelpMessage = "The name of the ADFS trusted login provider")]
195198
public string LoginProviderName;
196199

@@ -316,8 +319,8 @@ public class ConnectOnline : PSCmdlet
316319
public SwitchParameter SPOManagementShell;
317320

318321

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

336-
[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:
339+
[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:
337340
338341
* Read and write managed metadata
339342
* Have full control of all site collections
@@ -497,21 +500,32 @@ protected override void ProcessRecord()
497500
#if !NETSTANDARD2_0
498501
connection = SPOnlineConnectionHelper.InstantiateWebloginConnection(new Uri(Url), MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, Host, SkipTenantAdminCheck);
499502
#else
500-
WriteWarning(@"-UseWebLogin is not implemented, due to restrictions of the .NET Standard framework.
503+
WriteWarning(@"-UseWebLogin is not implemented, due to restrictions of the .NET Standard framework.
501504
Use -PnPO365ManagementShell instead");
502505
#endif
503506
}
504507
else if (UseAdfs)
505508
{
506-
if (creds == null)
509+
if (!Kerberos && creds == null)
507510
{
508511
if ((creds = GetCredentials()) == null)
509512
{
510513
creds = Host.UI.PromptForCredential(Properties.Resources.EnterYourCredentials, "", "", "");
511514
}
512515
}
513516
#if !NETSTANDARD2_0
514-
connection = SPOnlineConnectionHelper.InstantiateAdfsConnection(new Uri(Url), creds, Host, MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, NoTelemetry, SkipTenantAdminCheck, LoginProviderName);
517+
connection = SPOnlineConnectionHelper.InstantiateAdfsConnection(new Uri(Url),
518+
Kerberos,
519+
creds,
520+
Host,
521+
MinimalHealthScore,
522+
RetryCount,
523+
RetryWait,
524+
RequestTimeout,
525+
TenantAdminUrl,
526+
NoTelemetry,
527+
SkipTenantAdminCheck,
528+
LoginProviderName);
515529
#else
516530
throw new NotImplementedException();
517531
#endif
@@ -765,7 +779,7 @@ private SPOnlineConnection ConnectGraphDeviceLogin(string accessToken)
765779
}
766780
}
767781

768-
782+
769783
private void ConnectGraphAAD()
770784
{
771785
var appCredentials = new ClientCredential(AppSecret);

0 commit comments

Comments
 (0)