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

Commit ff784c8

Browse files
Merge pull request #1604 from SharePoint/dev
June 2018 Release
2 parents f03a9b3 + e9ca5bc commit ff784c8

18 files changed

+330
-54
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,22 @@ 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+
## [Unreleased]
9+
### Added
10+
11+
### Changed
12+
13+
### Deprecated
14+
15+
### Contributors
16+
817
## [2.27.1806.0]
918
### Added
19+
- Added Grant-PnPTenantServicePrincipalPermission to explicitely grant a permission on a resource for the tenant.
1020

1121
### Changed
22+
- Fixed edge cases where progress sent to PowerShell would be null, causing the provisioning of a template to end prematurely.
23+
- Fixed Unregister-PnPHubSite where you could not unregister a hub site if the site was deleted before unregistering
1224

1325
### Deprecated
1426

@@ -20,6 +32,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
2032
- Added -Timeout option to Add-PnPApp
2133
- Added -CollapseSpecification option to Submit-PnPSearchQuery
2234
- Added -InSiteHierarchy to Get-PnPField to search for fields in the site collection
35+
- Added Get-PnPSearchCrawlLog
2336

2437
### Changed
2538
- Fix for issue where using Add-PnPFile and setting Created and Modified did not update values

Commands/Admin/AddTenantCdnOrigin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace SharePointPnP.PowerShell.Commands.Admin
1818
SupportedPlatform = CmdletSupportedPlatform.Online,
1919
Category = CmdletHelpCategory.TenantAdmin)]
2020
[CmdletExample(
21-
Code = @"PS:> Add-PnPTenantCdnOrigin -Url /sites/site/subfolder -CdnType Public",
21+
Code = @"PS:> Add-PnPTenantCdnOrigin -OriginUrl /sites/site/subfolder -CdnType Public",
2222
Remarks = @"This example configures a public CDN on site level.", SortOrder = 1)]
2323
public class AddTenantCdnOrigin : PnPAdminCmdlet
2424
{

Commands/Admin/GrantHubSiteRights.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@
1010
namespace SharePointPnP.PowerShell.Commands.Admin
1111
{
1212
[Cmdlet(VerbsSecurity.Grant, "PnPHubSiteRights")]
13-
[CmdletHelp(@"Retrieve all or a specific hubsite.",
13+
[CmdletHelp(@"Grant Permissions to associate sites to Hub Sites.",
1414
Category = CmdletHelpCategory.TenantAdmin,
1515
SupportedPlatform = CmdletSupportedPlatform.Online)]
16-
[CmdletExample(Code = @"PS:> Get-PnPStorageEntity", Remarks = "Returns all site storage entities/farm properties", SortOrder = 1)]
17-
[CmdletExample(Code = @"PS:> Get-PnPTenantSite -Key MyKey", Remarks = "Returns the storage entity/farm property with the given key.", SortOrder = 2)]
16+
[CmdletExample(Code = @"PS:> Grant-PnPHubSiteRights -Identity https://contoso.sharepoint.com/sites/hubsite -Principals ""[email protected]"",""[email protected]"" -Rights Join", Remarks = "This example shows how to grant right to myuser and myotheruser to associate their sites with hubsite", SortOrder = 1)]
1817
public class GrantHubSiteRights : PnPAdminCmdlet
1918
{
2019
[Parameter(Position = 0, ValueFromPipeline = true, Mandatory = true)]
@@ -34,4 +33,4 @@ protected override void ExecuteCmdlet()
3433
}
3534
}
3635
}
37-
#endif
36+
#endif

Commands/Admin/RemoveHubSiteAssociation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace SharePointPnP.PowerShell.Commands.Admin
1717
SupportedPlatform = CmdletSupportedPlatform.Online,
1818
Category = CmdletHelpCategory.TenantAdmin)]
1919
[CmdletExample(
20-
Code = @"PS:> Remove-PnPHubSiteAssociation -Site https://tenant.sharepoint.com/sites/mysite -HubSite https://tenant.sharepoint.com/sites/hubsite",
20+
Code = @"PS:> Remove-PnPHubSiteAssociation -Site https://tenant.sharepoint.com/sites/mysite",
2121
Remarks = @"This example adds the specified site to the hubsite.", SortOrder = 1)]
2222
public class RemoveHubSiteAssociation : PnPAdminCmdlet
2323
{

Commands/Admin/UnregisterHubSite.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#if !ONPREMISES
2+
using System;
3+
using System.Linq;
24
using Microsoft.Online.SharePoint.TenantAdministration;
35
using Microsoft.SharePoint.Client;
46
using SharePointPnP.PowerShell.CmdletHelpAttributes;
57
using SharePointPnP.PowerShell.Commands.Base;
68
using System.Management.Automation;
7-
using OfficeDevPnP.Core.Sites;
89
using SharePointPnP.PowerShell.Commands.Base.PipeBinds;
9-
using System;
1010

1111
namespace SharePointPnP.PowerShell.Commands.Admin
1212
{
@@ -25,7 +25,12 @@ public class UnregisterHubSite : PnPAdminCmdlet
2525

2626
protected override void ExecuteCmdlet()
2727
{
28-
Tenant.UnregisterHubSite(Site.Url);
28+
var hubSitesProperties = Tenant.GetHubSitesProperties();
29+
ClientContext.Load(hubSitesProperties);
30+
ClientContext.ExecuteQueryRetry();
31+
var hubSite = hubSitesProperties.Single(h => h.SiteUrl.Equals(Site.Url, StringComparison.OrdinalIgnoreCase));
32+
33+
Tenant.UnregisterHubSiteById(hubSite.ID);
2934
ClientContext.ExecuteQueryRetry();
3035
}
3136
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#if !ONPREMISES
2+
using Microsoft.Online.SharePoint.TenantAdministration.Internal;
3+
using Microsoft.SharePoint.Client;
4+
using OfficeDevPnP.Core.ALM;
5+
using OfficeDevPnP.Core.Enums;
6+
using SharePointPnP.PowerShell.CmdletHelpAttributes;
7+
using SharePointPnP.PowerShell.Commands.Base;
8+
using SharePointPnP.PowerShell.Commands.Enums;
9+
using SharePointPnP.PowerShell.Commands.Model;
10+
using System.Linq;
11+
using System.Management.Automation;
12+
13+
namespace SharePointPnP.PowerShell.Commands.Apps
14+
{
15+
[Cmdlet(VerbsSecurity.Grant, "PnPTenantServicePrincipalPermission")]
16+
[CmdletHelp(@"Explicitely grants a specified permission to the ""SharePoint Online Client"" service principal",
17+
Category = CmdletHelpCategory.Apps, SupportedPlatform = CmdletSupportedPlatform.Online,
18+
OutputType = typeof(AppMetadata))]
19+
[CmdletExample(
20+
Code = @"PS:> Grant-PnPTenantServicePrincipalPermission -Scope ""Group.Read.All"" -Resource ""Microsoft Graph""",
21+
Remarks = @"This will explicitely grant the Group.Read.All permission on the Microsoft Graph resource", SortOrder = 1)]
22+
public class GrantTenantServicePrincipalPermission : PnPAdminCmdlet
23+
{
24+
[Parameter(Mandatory = true, HelpMessage = "The scope to grant the permission for")]
25+
public string Scope;
26+
27+
[Parameter(Mandatory = true, HelpMessage = "The resource to grant the permission for")]
28+
public string Resource;
29+
30+
protected override void ExecuteCmdlet()
31+
{
32+
var packageName = $"pnp-temporary-request-{System.Guid.NewGuid()}";
33+
var appCatalog = Tenant.GetAppCatalog();
34+
using (var appCatalogContext = ClientContext.Clone(appCatalog))
35+
{
36+
var list = appCatalogContext.Web.Lists.GetByTitle("Web Api Permission Requests");
37+
var itemCI = new ListItemCreationInformation();
38+
var item = list.AddItem(itemCI);
39+
item["_ows_PackageName"] = packageName;
40+
item["_ows_PackageVersion"] = "0.0.0.0";
41+
item["_ows_Scope"] = Scope;
42+
item["_ows_ResourceId"] = Resource;
43+
item.Update();
44+
appCatalogContext.ExecuteQueryRetry();
45+
}
46+
47+
var servicePrincipal = new SPOWebAppServicePrincipal(ClientContext);
48+
var requests = ClientContext.LoadQuery(servicePrincipal.PermissionRequests.Where(r => r.PackageName == packageName));
49+
ClientContext.ExecuteQueryRetry();
50+
if (requests.Any())
51+
{
52+
var newRequest = requests.First();
53+
var request = servicePrincipal.PermissionRequests.GetById(newRequest.Id);
54+
var grant = request.Approve();
55+
ClientContext.Load(grant);
56+
ClientContext.ExecuteQueryRetry();
57+
WriteObject(new TenantServicePrincipalPermissionGrant(grant));
58+
}
59+
}
60+
}
61+
}
62+
#endif

Commands/Base/ConnectOnline.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public class ConnectOnline : PSCmdlet
270270
#endif
271271
public string AppSecret;
272272

273-
[Parameter(Mandatory = true, ParameterSetName = ParameterSet_WEBLOGIN, HelpMessage = "If you want to connect to SharePoint with browser based login")]
273+
[Parameter(Mandatory = true, ParameterSetName = ParameterSet_WEBLOGIN, HelpMessage = "If you want to connect to SharePoint with browser based login. This is required when you have multi-factor authentication (MFA) enabled.")]
274274
public SwitchParameter UseWebLogin;
275275

276276
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_MAIN, HelpMessage = "Specify to use for instance use forms based authentication (FBA)")]

Commands/ClientSidePages/GetClientSideComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace SharePointPnP.PowerShell.Commands.ClientSidePages
1717
Code = @"PS:> Get-PnPClientSideComponent -Page Home",
1818
Remarks = @"Returns all controls defined on the given page.", SortOrder = 1)]
1919
[CmdletExample(
20-
Code = @"PS:> Get-PnPClientSideComponent -Page Home -Identity a2875399-d6ff-43a0-96da-be6ae5875f82",
20+
Code = @"PS:> Get-PnPClientSideComponent -Page Home -InstanceId a2875399-d6ff-43a0-96da-be6ae5875f82",
2121
Remarks = @"Returns a specific control defined on the given page.", SortOrder = 2)]
2222
public class GetClientSideControl : PnPWebCmdlet
2323
{

Commands/Graph/SetUnifiedGroup.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ public class SetUnifiedGroup : PnPGraphCmdlet
4545
[Parameter(Mandatory = false, HelpMessage = "The Description of the group to set.")]
4646
public string Description;
4747

48-
[Parameter(Mandatory = false, HelpMessage = "The array UPN values of owners to add to the group.")]
48+
[Parameter(Mandatory = false, HelpMessage = "The array UPN values of owners to set to the group. Note: Will replace owners.")]
4949
public String[] Owners;
5050

51-
[Parameter(Mandatory = false, HelpMessage = "The array UPN values of members to add to the group.")]
51+
[Parameter(Mandatory = false, HelpMessage = "The array UPN values of members to set to the group. Note: Will replace members.")]
5252
public String[] Members;
5353

5454
[Parameter(Mandatory = false, HelpMessage = "Makes the group private when selected.")]

Commands/Lists/RemoveList.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class RemoveList : PnPWebCmdlet
2525
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The ID or Title of the list.")]
2626
public ListPipeBind Identity = new ListPipeBind();
2727

28-
[Parameter(Mandatory = false)]
28+
[Parameter(Mandatory = false, HelpMessage = "Defines if the list should be moved to recycle bin or directly deleted.")]
2929
public SwitchParameter Recycle;
3030

3131
[Parameter(Mandatory = false, HelpMessage = "Specifying the Force parameter will skip the confirmation question.")]

0 commit comments

Comments
 (0)