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

Commit 7174908

Browse files
Merge pull request #2616 from pnp/dev
April 2020 Release
2 parents 3f994e7 + c053b05 commit 7174908

File tree

61 files changed

+1894
-587
lines changed

Some content is hidden

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

61 files changed

+1894
-587
lines changed

CHANGELOG.md

+33-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,39 @@ All notable changes to this project will be documented in this file.
55

66
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
77

8-
## [3.19.2003.0] - Unreleased
8+
## [3.20.2004.0]
9+
10+
### Added
11+
- Added Set-PnPKnowledgeHubSite, Get-PnPKnowledgeHubSite and Remove-PnPKnowledgeHubSite cmdlets
12+
- Added Register-PnPTenantAppCatalog to create and register a new Tenant App Catalog
13+
- Added `IncludeHasTeam` flag to `Get-PnPUnifiedGroup` to include a `HasTeam` flag for each returned Office 365 Group indicating if a Microsoft Team has been set up for it [PR #2612](https://github.com/SharePoint/PnP-PowerShell/pull/2612)
14+
- Added Initialize-PnPPowerShellAuthentication to create a new Azure AD App, self-signed certificate and set the appropriate permission scopes.
15+
16+
### Changed
17+
- Connect-PnPOnline with clientid and certificate will now, if API permissions have been granted for the Graph work with the PnP Graph Cmdlets. [PR #2515](https://github.com/SharePoint/PnP-PowerShell/pull/2515)
18+
- Save-PnPProvisioningTemplate and Save-PnPTenantTemplate now support XML file as input without the need to first read them into a variable with Read-PnPProvisioningTemplate or Read-PnPTenantTemplate
19+
- Added -Schema parameter to Save-PnPProvisioningTemplate and Save-PnPTenantTemplate to force a specific schema for the embedded template. If not specified it defaults always to the latest released template.
20+
- Fixed using `Connect-PnPOnline -PnPO365ManagementShell` only working if your default system language is English [PR #2613](https://github.com/SharePoint/PnP-PowerShell/pull/2613)
21+
- Updated help text of 'Get-PnPClientSidePage' and 'Get-PnPClientSideComponent' to indicate that the out of the box homepage of a modern site will not return its contents as designed [PR #2592](https://github.com/SharePoint/PnP-PowerShell/pull/2592)
22+
- Fixed using `Connect-PnPOnline -PnPO365ManagementShell` not working in PowerShell ISE [PR #2590](https://github.com/SharePoint/PnP-PowerShell/pull/2590)
23+
- Uploading files using `Add-PnPFile` no longer requires Site Owner rights on the entire site. Read rights on the site and at least contribute rights on the document library where the file needs to be uploaded to will suffice as long as the target folder already exists. [PR #2478](https://github.com/SharePoint/PnP-PowerShell/pull/2478)
24+
- Use of `Set-PnPSite` in combination with `-Owners`, `-NoScriptSite`, `-LocaleId` and/or `-AllowSelfServiceUpgrade` is now possible on SharePoint 2013, 2016 and 2019 as well [PR #2293](https://github.com/SharePoint/PnP-PowerShell/pull/2293)
25+
- Using `Connect-PnPOnline -CurrentCredentials` against an on-premises SharePoint farm having more than one authentication provider configured on the webapplication no longer causes an access denied [PR #2571](https://github.com/SharePoint/PnP-PowerShell/pull/2571)
26+
- Fixed `Add-PnPSiteDesignTask` not actually applying the Site Design to the site [PR #2542](https://github.com/SharePoint/PnP-PowerShell/pull/2542)
27+
- Fixed `Get-PnPSiteDesignTask` throwing a collection not initialized error [PR #2545](https://github.com/SharePoint/PnP-PowerShell/pull/2545)
28+
29+
### Contributors
30+
- Lane Blundell [fastlaneb]
31+
- Markus Hanisch [Markus-Hanisch]
32+
- Dan Myhre [danmyhre]
33+
- Jens Otto Hatlevold [jensotto]
34+
- Raphael [PowershellNinja]
35+
- Razvan Hrestic [CodingSinceThe80s]
36+
- Giacomo Pozzoni [jackpoz]
37+
- [victorbutuza]
38+
- Koen Zomers [koenzomers]
39+
40+
## [3.19.2003.0]
941

1042
### Added
1143
- Added `-HeaderLayoutType` option to `Add-PnPClientSidePage` which allows setting the header layout of a new Site Page [PR # 2514](https://github.com/SharePoint/PnP-PowerShell/pull/2514)
@@ -22,7 +54,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
2254
- The February 2020 release of PnP PowerShell was throwing an error on not being able to find and load the Newtonsoft assembly when used in an Azure Function. Fixed in this release.
2355

2456
### Contributors
25-
2657
- Arun Kumar Perumal [arunkumarperumal]
2758
- Paul Bullock [pkbullock]
2859
- Jens Otto Hatlevold [jensotto]
@@ -61,7 +92,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
6192
- Fix examples in Start-PnPWorkflowInstance [PR #2483](https://github.com/SharePoint/PnP-PowerShell/pull/2483)
6293

6394
### Contributors
64-
6595
- Ivan Vagunin [ivanvagunin]
6696
- Thomas Meckel [tmeckel]
6797
- Koen Zomers [koenzomers]

Commands/Admin/GetKnowledgeHubSite.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, "PnPKnowledgeHubSite")]
10+
[CmdletHelp("Gets the Knowledge Hub Site URL for your tenant",
11+
SupportedPlatform = CmdletSupportedPlatform.Online,
12+
Category = CmdletHelpCategory.TenantAdmin)]
13+
[CmdletExample(
14+
Code = @"PS:> Get-PnPKnowledgeHubSite",
15+
Remarks = @"Returns the Knowledge Hub Site Url for your tenant", SortOrder = 1)]
16+
public class GetKnowledgeHubSite : PnPAdminCmdlet
17+
{
18+
protected override void ExecuteCmdlet()
19+
{
20+
var results = Tenant.GetKnowledgeHubSite();
21+
Tenant.Context.ExecuteQueryRetry();
22+
WriteObject(results.Value);
23+
}
24+
}
25+
}
26+
#endif

Commands/Admin/GetTenant.cs

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
#if !ONPREMISES
2-
using Microsoft.Online.SharePoint.TenantAdministration;
32
using Microsoft.SharePoint.Client;
43
using SharePointPnP.PowerShell.CmdletHelpAttributes;
54
using SharePointPnP.PowerShell.Commands.Base;
65
using System.Management.Automation;
7-
using OfficeDevPnP.Core.Sites;
8-
using SharePointPnP.PowerShell.Commands.Base.PipeBinds;
9-
using System;
10-
using SharePointPnP.PowerShell.Commands.Enums;
11-
using System.Collections.Generic;
126
using SharePointPnP.PowerShell.Commands.Model;
137

148
namespace SharePointPnP.PowerShell.Commands.Admin
@@ -20,7 +14,7 @@ namespace SharePointPnP.PowerShell.Commands.Admin
2014
2115
Currently, there are no parameters for this cmdlet.
2216
23-
You must be a SharePoint Online global administrator to run the cmdlet.",
17+
You must have the SharePoint Online admin or Global admin role to run the cmdlet.",
2418
SupportedPlatform = CmdletSupportedPlatform.Online,
2519
Category = CmdletHelpCategory.TenantAdmin)]
2620
[CmdletExample(

Commands/Admin/GetTenantSite.cs

+49-37
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if !ONPREMISES
1+
#if !SP2013
22
using System;
33
using System.Linq;
44
using System.Management.Automation;
@@ -14,28 +14,33 @@ namespace SharePointPnP.PowerShell.Commands
1414
[Cmdlet(VerbsCommon.Get, "PnPTenantSite", SupportsShouldProcess = true)]
1515
[CmdletHelp(@"Retrieve site information.", "Use this cmdlet to retrieve site information from your tenant administration.",
1616
Category = CmdletHelpCategory.TenantAdmin,
17-
SupportedPlatform = CmdletSupportedPlatform.Online,
17+
SupportedPlatform = CmdletSupportedPlatform.SP2016 | CmdletSupportedPlatform.SP2019 | CmdletSupportedPlatform.Online,
1818
OutputType = typeof(Microsoft.Online.SharePoint.TenantAdministration.SiteProperties),
1919
OutputTypeLink = "https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.siteproperties.aspx")]
2020
[CmdletExample(Code = @"PS:> Get-PnPTenantSite", Remarks = "Returns all site collections", SortOrder = 1)]
2121
[CmdletExample(Code = @"PS:> Get-PnPTenantSite -Url http://tenant.sharepoint.com/sites/projects", Remarks = "Returns information about the project site", SortOrder = 2)]
2222
[CmdletExample(Code = @"PS:> Get-PnPTenantSite -Detailed", Remarks = "Returns all sites with the full details of these sites", SortOrder = 3)]
23+
#if !ONPREMISES
2324
[CmdletExample(Code = @"PS:> Get-PnPTenantSite -IncludeOneDriveSites", Remarks = "Returns all sites including all OneDrive for Business sites", SortOrder = 4)]
2425
[CmdletExample(Code = @"PS:> Get-PnPTenantSite -IncludeOneDriveSites -Filter ""Url -like '-my.sharepoint.com/personal/'""", Remarks = "Returns all OneDrive for Business sites", SortOrder = 5)]
2526
[CmdletExample(Code = @"PS:> Get-PnPTenantSite -Template SITEPAGEPUBLISHING#0", Remarks = "Returns all Communication sites", SortOrder = 6)]
2627
[CmdletExample(Code = @"PS:> Get-PnPTenantSite -Filter ""Url -like 'sales'"" ", Remarks = "Returns all sites including 'sales' in the url", SortOrder = 7)]
28+
#endif
2729
public class GetTenantSite : PnPAdminCmdlet
2830
{
2931
[Parameter(Mandatory = false, HelpMessage = "The URL of the site", Position = 0, ValueFromPipeline = true)]
3032
[Alias("Identity")]
3133
public string Url;
3234

35+
#if !ONPREMISES
3336
[Parameter(Mandatory = false, HelpMessage = @"By default, all sites will be returned. Specify a template value alike ""STS#0"" here to filter on the template")]
3437
public string Template;
38+
#endif
3539

3640
[Parameter(Mandatory = false, HelpMessage = "By default, not all returned attributes are populated. This switch populates all attributes. It can take several seconds to run. Without this, some attributes will show default values that may not be correct.")]
3741
public SwitchParameter Detailed;
3842

43+
#if !ONPREMISES
3944
[Parameter(Mandatory = false, HelpMessage = "By default, the OneDrives are not returned. This switch includes all OneDrives.")]
4045
public SwitchParameter IncludeOneDriveSites;
4146

@@ -49,54 +54,61 @@ public class GetTenantSite : PnPAdminCmdlet
4954

5055
[Parameter(Mandatory = false, HelpMessage = "Specifies the script block of the server-side filter to apply. See https://technet.microsoft.com/en-us/library/fp161380.aspx")]
5156
public string Filter;
57+
#endif
5258

5359
protected override void ExecuteCmdlet()
5460
{
55-
if (SPOnlineConnection.CurrentConnection.ConnectionType == ConnectionType.OnPrem)
61+
if (!string.IsNullOrEmpty(Url))
5662
{
57-
WriteObject(ClientContext.Site);
63+
var list = Tenant.GetSitePropertiesByUrl(Url, Detailed);
64+
list.Context.Load(list);
65+
list.Context.ExecuteQueryRetry();
66+
WriteObject(list, true);
5867
}
5968
else
6069
{
61-
if (!string.IsNullOrEmpty(Url))
70+
#if !ONPREMISES
71+
SPOSitePropertiesEnumerableFilter filter = new SPOSitePropertiesEnumerableFilter()
6272
{
63-
var list = Tenant.GetSitePropertiesByUrl(Url, Detailed);
64-
list.Context.Load(list);
65-
list.Context.ExecuteQueryRetry();
66-
WriteObject(list, true);
67-
}
68-
else
69-
{
70-
SPOSitePropertiesEnumerableFilter filter = new SPOSitePropertiesEnumerableFilter()
71-
{
72-
IncludePersonalSite = IncludeOneDriveSites.IsPresent ? PersonalSiteFilter.Include : PersonalSiteFilter.UseServerDefault,
73-
IncludeDetail = Detailed,
73+
IncludePersonalSite = IncludeOneDriveSites.IsPresent ? PersonalSiteFilter.Include : PersonalSiteFilter.UseServerDefault,
74+
IncludeDetail = Detailed,
7475
#pragma warning disable CS0618 // Type or member is obsolete
75-
Template = Template ?? WebTemplate,
76+
Template = Template ?? WebTemplate,
7677
#pragma warning restore CS0618 // Type or member is obsolete
77-
Filter = Filter,
78-
};
78+
Filter = Filter,
79+
};
7980

80-
SPOSitePropertiesEnumerable sitesList = null;
81-
var sites = new List<SiteProperties>();
82-
do
83-
{
84-
sitesList = Tenant.GetSitePropertiesFromSharePointByFilters(filter);
85-
Tenant.Context.Load(sitesList);
86-
Tenant.Context.ExecuteQueryRetry();
87-
sites.AddRange(sitesList.ToList());
88-
filter.StartIndex = sitesList.NextStartIndexFromSharePoint;
89-
} while (!string.IsNullOrWhiteSpace(sitesList.NextStartIndexFromSharePoint));
81+
#endif
82+
SPOSitePropertiesEnumerable sitesList = null;
83+
var sites = new List<SiteProperties>();
84+
#if !ONPREMISES
85+
do
86+
{
87+
sitesList = Tenant.GetSitePropertiesFromSharePointByFilters(filter);
88+
Tenant.Context.Load(sitesList);
89+
Tenant.Context.ExecuteQueryRetry();
90+
sites.AddRange(sitesList.ToList());
91+
filter.StartIndex = sitesList.NextStartIndexFromSharePoint;
92+
} while (!string.IsNullOrWhiteSpace(sitesList.NextStartIndexFromSharePoint));
93+
#else
94+
sitesList = Tenant.GetSiteProperties(0, Detailed);
95+
Tenant.Context.Load(sitesList);
96+
Tenant.Context.ExecuteQueryRetry();
97+
sites.AddRange(sitesList.ToList());
98+
#endif
9099

91-
if (Template != null)
92-
{
93-
WriteObject(sites.Where(t => t.Template == Template).OrderBy(x => x.Url), true);
94-
}
95-
else
96-
{
97-
WriteObject(sites.OrderBy(x => x.Url), true);
98-
}
100+
#if !ONPREMISES
101+
if (Template != null)
102+
{
103+
WriteObject(sites.Where(t => t.Template == Template).OrderBy(x => x.Url), true);
104+
}
105+
else
106+
{
107+
WriteObject(sites.OrderBy(x => x.Url), true);
99108
}
109+
#else
110+
WriteObject(sites.OrderBy(x => x.Url), true);
111+
#endif
100112
}
101113
}
102114
}

Commands/Admin/GetWebTemplates.cs

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
#if !ONPREMISES
2-
using SharePointPnP.PowerShell.CmdletHelpAttributes;
1+
using SharePointPnP.PowerShell.CmdletHelpAttributes;
32
using Microsoft.SharePoint.Client;
43
using SharePointPnP.PowerShell.Commands.Base;
54
using System.Management.Automation;
65

76
namespace SharePointPnP.PowerShell.Commands
87
{
98
[Cmdlet(VerbsCommon.Get, "PnPWebTemplates")]
10-
[CmdletHelp(@"Returns the available web templates.",
11-
"Will list all available templates one can use to create a classic site.",
9+
[CmdletHelp(@"Returns the available web templates",
10+
"Will list all available templates one can use to create a site",
1211
Category = CmdletHelpCategory.TenantAdmin,
13-
SupportedPlatform = CmdletSupportedPlatform.Online,
14-
OutputType =typeof(Microsoft.Online.SharePoint.TenantAdministration.SPOTenantWebTemplateCollection),
15-
OutputTypeLink = "https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.spotenantwebtemplatecollection.aspx")]
12+
SupportedPlatform = CmdletSupportedPlatform.All,
13+
OutputType = typeof(Microsoft.Online.SharePoint.TenantAdministration.SPOTenantWebTemplateCollection),
14+
OutputTypeLink = "https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-csom/dn174817(v=office.15)")]
1615
[CmdletExample(Code = @"PS:> Get-PnPWebTemplates", SortOrder = 1)]
1716
[CmdletExample(Code = @"PS:> Get-PnPWebTemplates -LCID 1033", Remarks = @"Returns all webtemplates for the Locale with ID 1033 (English)", SortOrder = 2)]
1817
[CmdletExample(Code = @"PS:> Get-PnPWebTemplates -CompatibilityLevel 15", Remarks = @"Returns all webtemplates for the compatibility level 15", SortOrder = 2)]
1918
[CmdletRelatedLink(Text = "Locale IDs", Url = "http://go.microsoft.com/fwlink/p/?LinkId=242911Id=242911")]
2019
public class GetWebTemplates : PnPAdminCmdlet
2120
{
22-
[Parameter(Mandatory = false, HelpMessage = "The language ID. For instance: 1033 for English")]
21+
[Parameter(Mandatory = false, HelpMessage = "The language ID. For instance: 1033 for English.")]
2322
public uint Lcid;
2423

2524
[Parameter(Mandatory = false, HelpMessage = "The version of SharePoint")]
@@ -31,4 +30,3 @@ protected override void ProcessRecord()
3130
}
3231
}
3332
}
34-
#endif

Commands/Admin/NewSite.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using SharePointPnP.PowerShell.Commands.Base.PipeBinds;
66
using SharePointPnP.PowerShell.Commands.Enums;
77
using System;
8+
using SharePointPnP.PowerShell.Commands.Base;
89

910
namespace SharePointPnP.PowerShell.Commands
1011
{
@@ -160,7 +161,7 @@ protected override void ExecuteCmdlet()
160161
}
161162
creationInformation.Owners = _teamSiteParameters.Owners;
162163

163-
var returnedContext = OfficeDevPnP.Core.Sites.SiteCollection.Create(ClientContext, creationInformation, noWait:!Wait);
164+
var returnedContext = OfficeDevPnP.Core.Sites.SiteCollection.Create(ClientContext, creationInformation, noWait:!Wait, graphAccessToken: SPOnlineConnection.CurrentConnection.AccessToken);
164165
//var results = ClientContext.CreateSiteAsync(creationInformation);
165166
//var returnedContext = results.GetAwaiter().GetResult();
166167
WriteObject(returnedContext.Url);

Commands/Admin/NewTenantSite.cs

+2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ protected override void ExecuteCmdlet()
114114
#else
115115
Func<TenantOperationMessage, bool> timeoutFunction = TimeoutFunction;
116116

117+
#pragma warning disable CS0618 // Type or member is obsolete
117118
if (ParameterSpecified(nameof(Description)))
119+
#pragma warning restore CS0618 // Type or member is obsolete
118120
{
119121
// 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.
120122
Wait = true;
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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.Apps
8+
{
9+
[Cmdlet(VerbsLifecycle.Register, "PnPAppCatalogSite")]
10+
[CmdletHelp("Creates a new App Catalog Site and sets this site as the Tenant App Catalog",
11+
Category = CmdletHelpCategory.TenantAdmin, SupportedPlatform = CmdletSupportedPlatform.Online)]
12+
[CmdletExample(
13+
Code = @"PS:> Register-PnPAppCatalogSite -Url https://yourtenant.sharepoint.com/sites/appcatalog -Owner [email protected] -TimeZoneId 4",
14+
Remarks = @"This will create a new appcatalog site if no app catalog is already present. Use -Force to create a new appcatalog site if one has already been registered. If using the same URL as an existing one and Force is present, the current/existing appcatalog site will be deleted.", SortOrder = 1)]
15+
public class RegisterAppCatalogSite : PnPAdminCmdlet
16+
{
17+
18+
[Parameter(Mandatory = true, HelpMessage = "The full url of the app catalog site to be created, e.g. https://yourtenant.sharepoint.com/sites/appcatalog")]
19+
public string Url;
20+
21+
[Parameter(Mandatory = true, HelpMessage = "The login account of the user designated to be the admin for the site, e.g. [email protected]")]
22+
public string Owner;
23+
24+
[Parameter(Mandatory = true, HelpMessage = "Use Get-PnPTimeZoneId to retrieve possible timezone values")]
25+
public int TimeZoneId;
26+
27+
[Parameter(Mandatory = false, HelpMessage ="If specified, and an app catalog is already present, a new app catalog site will be created. If the same URL is used the existing/current app catalog site will be deleted first.")]
28+
public SwitchParameter Force;
29+
30+
protected override void ExecuteCmdlet()
31+
{
32+
WriteWarning("Notice that this cmdlet can take considerate time to finish executing.");
33+
Tenant.EnsureAppCatalogAsync(Url, Owner, TimeZoneId, Force).GetAwaiter().GetResult();
34+
}
35+
}
36+
}
37+
#endif

0 commit comments

Comments
 (0)