Skip to content
This repository was archived by the owner on Jan 19, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
79886e5
Update GrantHubSiteRights.cs
spcrux May 14, 2018
d4a4be9
Removed duplicate output
erwinvanhunen May 17, 2018
05ec884
updated version
erwinvanhunen May 17, 2018
2aa567b
Merge pull request #1571 from erwinvanhunen/dev
erwinvanhunen May 17, 2018
9ae1102
fixed null message handling in progress handler
erwinvanhunen May 17, 2018
4aa955f
Merge pull request #1572 from erwinvanhunen/dev
erwinvanhunen May 17, 2018
e0835ce
Added cmdlet for fetching crawllog entries.
wobba May 19, 2018
e7c9da0
Merge pull request #1575 from wobba/GetSearchCrawlLog
wobba May 19, 2018
f2fb74d
Added Grant-PnPTenantServicePrincipalPermission
erwinvanhunen May 24, 2018
c2242e2
Merge pull request #1581 from erwinvanhunen/dev
erwinvanhunen May 24, 2018
0d2d7b9
Feat(RemoveWebPart): homogeneity of documentation
Laul0 May 25, 2018
5e32740
#1621
wobba May 28, 2018
d8aaf22
Merge pull request #1588 from wobba/UnRegisterHubSite
wobba May 28, 2018
e85c8f1
Merge pull request #1586 from Laul0/RemoveWebPart-Doc
erwinvanhunen May 31, 2018
2a55f57
Change message to explicilty say that owners/members will be replaced…
wobba Jun 6, 2018
91a6c51
Typo and documentation fixes for the auto-generated documentation
VesaJuvonen Jun 6, 2018
b89fa8c
Merge pull request #1565 from spcrux/patch-1
erwinvanhunen Jun 7, 2018
e329f59
updated graph sdk
erwinvanhunen Jun 8, 2018
1fc0618
Merge pull request #1600 from erwinvanhunen/dev
erwinvanhunen Jun 8, 2018
6563315
fixed typos
erwinvanhunen Jun 8, 2018
752b877
Merge pull request #1601 from erwinvanhunen/dev
erwinvanhunen Jun 8, 2018
0e51664
updated changelog
erwinvanhunen Jun 8, 2018
e9ca5bc
Merge pull request #1603 from erwinvanhunen/dev
erwinvanhunen Jun 10, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@ All notable changes to this project will be documented in this file.

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

## [Unreleased]
### Added

### Changed

### Deprecated

### Contributors

## [2.27.1806.0]
### Added
- Added Grant-PnPTenantServicePrincipalPermission to explicitely grant a permission on a resource for the tenant.

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

### Deprecated

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

### Changed
- Fix for issue where using Add-PnPFile and setting Created and Modified did not update values
Expand Down
2 changes: 1 addition & 1 deletion Commands/Admin/AddTenantCdnOrigin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace SharePointPnP.PowerShell.Commands.Admin
SupportedPlatform = CmdletSupportedPlatform.Online,
Category = CmdletHelpCategory.TenantAdmin)]
[CmdletExample(
Code = @"PS:> Add-PnPTenantCdnOrigin -Url /sites/site/subfolder -CdnType Public",
Code = @"PS:> Add-PnPTenantCdnOrigin -OriginUrl /sites/site/subfolder -CdnType Public",
Remarks = @"This example configures a public CDN on site level.", SortOrder = 1)]
public class AddTenantCdnOrigin : PnPAdminCmdlet
{
Expand Down
7 changes: 3 additions & 4 deletions Commands/Admin/GrantHubSiteRights.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
namespace SharePointPnP.PowerShell.Commands.Admin
{
[Cmdlet(VerbsSecurity.Grant, "PnPHubSiteRights")]
[CmdletHelp(@"Retrieve all or a specific hubsite.",
[CmdletHelp(@"Grant Permissions to associate sites to Hub Sites.",
Category = CmdletHelpCategory.TenantAdmin,
SupportedPlatform = CmdletSupportedPlatform.Online)]
[CmdletExample(Code = @"PS:> Get-PnPStorageEntity", Remarks = "Returns all site storage entities/farm properties", SortOrder = 1)]
[CmdletExample(Code = @"PS:> Get-PnPTenantSite -Key MyKey", Remarks = "Returns the storage entity/farm property with the given key.", SortOrder = 2)]
[CmdletExample(Code = @"PS:> Grant-PnPHubSiteRights -Identity https://contoso.sharepoint.com/sites/hubsite -Principals ""myuser@mydomain.com"",""myotheruser@mydomain.com"" -Rights Join", Remarks = "This example shows how to grant right to myuser and myotheruser to associate their sites with hubsite", SortOrder = 1)]
public class GrantHubSiteRights : PnPAdminCmdlet
{
[Parameter(Position = 0, ValueFromPipeline = true, Mandatory = true)]
Expand All @@ -34,4 +33,4 @@ protected override void ExecuteCmdlet()
}
}
}
#endif
#endif
2 changes: 1 addition & 1 deletion Commands/Admin/RemoveHubSiteAssociation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace SharePointPnP.PowerShell.Commands.Admin
SupportedPlatform = CmdletSupportedPlatform.Online,
Category = CmdletHelpCategory.TenantAdmin)]
[CmdletExample(
Code = @"PS:> Remove-PnPHubSiteAssociation -Site https://tenant.sharepoint.com/sites/mysite -HubSite https://tenant.sharepoint.com/sites/hubsite",
Code = @"PS:> Remove-PnPHubSiteAssociation -Site https://tenant.sharepoint.com/sites/mysite",
Remarks = @"This example adds the specified site to the hubsite.", SortOrder = 1)]
public class RemoveHubSiteAssociation : PnPAdminCmdlet
{
Expand Down
11 changes: 8 additions & 3 deletions Commands/Admin/UnregisterHubSite.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#if !ONPREMISES
using System;
using System.Linq;
using Microsoft.Online.SharePoint.TenantAdministration;
using Microsoft.SharePoint.Client;
using SharePointPnP.PowerShell.CmdletHelpAttributes;
using SharePointPnP.PowerShell.Commands.Base;
using System.Management.Automation;
using OfficeDevPnP.Core.Sites;
using SharePointPnP.PowerShell.Commands.Base.PipeBinds;
using System;

namespace SharePointPnP.PowerShell.Commands.Admin
{
Expand All @@ -25,7 +25,12 @@ public class UnregisterHubSite : PnPAdminCmdlet

protected override void ExecuteCmdlet()
{
Tenant.UnregisterHubSite(Site.Url);
var hubSitesProperties = Tenant.GetHubSitesProperties();
ClientContext.Load(hubSitesProperties);
ClientContext.ExecuteQueryRetry();
var hubSite = hubSitesProperties.Single(h => h.SiteUrl.Equals(Site.Url, StringComparison.OrdinalIgnoreCase));

Tenant.UnregisterHubSiteById(hubSite.ID);
ClientContext.ExecuteQueryRetry();
}
}
Expand Down
62 changes: 62 additions & 0 deletions Commands/Apps/GrantTenantServicePrincipalPermission.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#if !ONPREMISES
using Microsoft.Online.SharePoint.TenantAdministration.Internal;
using Microsoft.SharePoint.Client;
using OfficeDevPnP.Core.ALM;
using OfficeDevPnP.Core.Enums;
using SharePointPnP.PowerShell.CmdletHelpAttributes;
using SharePointPnP.PowerShell.Commands.Base;
using SharePointPnP.PowerShell.Commands.Enums;
using SharePointPnP.PowerShell.Commands.Model;
using System.Linq;
using System.Management.Automation;

namespace SharePointPnP.PowerShell.Commands.Apps
{
[Cmdlet(VerbsSecurity.Grant, "PnPTenantServicePrincipalPermission")]
[CmdletHelp(@"Explicitely grants a specified permission to the ""SharePoint Online Client"" service principal",
Category = CmdletHelpCategory.Apps, SupportedPlatform = CmdletSupportedPlatform.Online,
OutputType = typeof(AppMetadata))]
[CmdletExample(
Code = @"PS:> Grant-PnPTenantServicePrincipalPermission -Scope ""Group.Read.All"" -Resource ""Microsoft Graph""",
Remarks = @"This will explicitely grant the Group.Read.All permission on the Microsoft Graph resource", SortOrder = 1)]
public class GrantTenantServicePrincipalPermission : PnPAdminCmdlet
{
[Parameter(Mandatory = true, HelpMessage = "The scope to grant the permission for")]
public string Scope;

[Parameter(Mandatory = true, HelpMessage = "The resource to grant the permission for")]
public string Resource;

protected override void ExecuteCmdlet()
{
var packageName = $"pnp-temporary-request-{System.Guid.NewGuid()}";
var appCatalog = Tenant.GetAppCatalog();
using (var appCatalogContext = ClientContext.Clone(appCatalog))
{
var list = appCatalogContext.Web.Lists.GetByTitle("Web Api Permission Requests");
var itemCI = new ListItemCreationInformation();
var item = list.AddItem(itemCI);
item["_ows_PackageName"] = packageName;
item["_ows_PackageVersion"] = "0.0.0.0";
item["_ows_Scope"] = Scope;
item["_ows_ResourceId"] = Resource;
item.Update();
appCatalogContext.ExecuteQueryRetry();
}

var servicePrincipal = new SPOWebAppServicePrincipal(ClientContext);
var requests = ClientContext.LoadQuery(servicePrincipal.PermissionRequests.Where(r => r.PackageName == packageName));
ClientContext.ExecuteQueryRetry();
if (requests.Any())
{
var newRequest = requests.First();
var request = servicePrincipal.PermissionRequests.GetById(newRequest.Id);
var grant = request.Approve();
ClientContext.Load(grant);
ClientContext.ExecuteQueryRetry();
WriteObject(new TenantServicePrincipalPermissionGrant(grant));
}
}
}
}
#endif
2 changes: 1 addition & 1 deletion Commands/Base/ConnectOnline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public class ConnectOnline : PSCmdlet
#endif
public string AppSecret;

[Parameter(Mandatory = true, ParameterSetName = ParameterSet_WEBLOGIN, HelpMessage = "If you want to connect to SharePoint with browser based login")]
[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.")]
public SwitchParameter UseWebLogin;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_MAIN, HelpMessage = "Specify to use for instance use forms based authentication (FBA)")]
Expand Down
2 changes: 1 addition & 1 deletion Commands/ClientSidePages/GetClientSideComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace SharePointPnP.PowerShell.Commands.ClientSidePages
Code = @"PS:> Get-PnPClientSideComponent -Page Home",
Remarks = @"Returns all controls defined on the given page.", SortOrder = 1)]
[CmdletExample(
Code = @"PS:> Get-PnPClientSideComponent -Page Home -Identity a2875399-d6ff-43a0-96da-be6ae5875f82",
Code = @"PS:> Get-PnPClientSideComponent -Page Home -InstanceId a2875399-d6ff-43a0-96da-be6ae5875f82",
Remarks = @"Returns a specific control defined on the given page.", SortOrder = 2)]
public class GetClientSideControl : PnPWebCmdlet
{
Expand Down
4 changes: 2 additions & 2 deletions Commands/Graph/SetUnifiedGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ public class SetUnifiedGroup : PnPGraphCmdlet
[Parameter(Mandatory = false, HelpMessage = "The Description of the group to set.")]
public string Description;

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

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

[Parameter(Mandatory = false, HelpMessage = "Makes the group private when selected.")]
Expand Down
2 changes: 1 addition & 1 deletion Commands/Lists/RemoveList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class RemoveList : PnPWebCmdlet
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The ID or Title of the list.")]
public ListPipeBind Identity = new ListPipeBind();

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

[Parameter(Mandatory = false, HelpMessage = "Specifying the Force parameter will skip the confirmation question.")]
Expand Down
4 changes: 2 additions & 2 deletions Commands/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.26.1805.1")]
[assembly: AssemblyFileVersion("2.26.1805.1")]
[assembly: AssemblyVersion("2.27.1806.0")]
[assembly: AssemblyFileVersion("2.27.1806.0")]
[assembly: InternalsVisibleTo("SharePointPnP.PowerShell.Tests")]
56 changes: 31 additions & 25 deletions Commands/Provisioning/ApplyProvisioningTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,15 @@ protected override void ExecuteCmdlet()

applyingInformation.ProgressDelegate = (message, step, total) =>
{
var percentage = Convert.ToInt32((100 / Convert.ToDouble(total)) * Convert.ToDouble(step));
progressRecord.Activity = $"Applying template to {SelectedWeb.Url}";
progressRecord.StatusDescription = message;
progressRecord.PercentComplete = percentage;
progressRecord.RecordType = ProgressRecordType.Processing;
WriteProgress(progressRecord);
if (message != null)
{
var percentage = Convert.ToInt32((100 / Convert.ToDouble(total)) * Convert.ToDouble(step));
progressRecord.Activity = $"Applying template to {SelectedWeb.Url}";
progressRecord.StatusDescription = message;
progressRecord.PercentComplete = percentage;
progressRecord.RecordType = ProgressRecordType.Processing;
WriteProgress(progressRecord);
}
};

var warningsShown = new List<string>();
Expand All @@ -296,19 +299,30 @@ protected override void ExecuteCmdlet()
}
case ProvisioningMessageType.Progress:
{
var activity = message;
if (message.IndexOf("|") > -1)
if (message != null)
{
var messageSplitted = message.Split('|');
if (messageSplitted.Length == 4)
var activity = message;
if (message.IndexOf("|") > -1)
{
var current = double.Parse(messageSplitted[2]);
var total = double.Parse(messageSplitted[3]);
subProgressRecord.RecordType = ProgressRecordType.Processing;
subProgressRecord.Activity = messageSplitted[0];
subProgressRecord.StatusDescription = messageSplitted[1];
subProgressRecord.PercentComplete = Convert.ToInt32((100 / total) * current);
WriteProgress(subProgressRecord);
var messageSplitted = message.Split('|');
if (messageSplitted.Length == 4)
{
var current = double.Parse(messageSplitted[2]);
var total = double.Parse(messageSplitted[3]);
subProgressRecord.RecordType = ProgressRecordType.Processing;
subProgressRecord.Activity = string.IsNullOrEmpty(messageSplitted[0]) ? "-" : messageSplitted[0];
subProgressRecord.StatusDescription = string.IsNullOrEmpty(messageSplitted[1]) ? "-" : messageSplitted[1];
subProgressRecord.PercentComplete = Convert.ToInt32((100 / total) * current);
WriteProgress(subProgressRecord);
}
else
{
subProgressRecord.Activity = "Processing";
subProgressRecord.RecordType = ProgressRecordType.Processing;
subProgressRecord.StatusDescription = activity;
subProgressRecord.PercentComplete = 0;
WriteProgress(subProgressRecord);
}
}
else
{
Expand All @@ -319,14 +333,6 @@ protected override void ExecuteCmdlet()
WriteProgress(subProgressRecord);
}
}
else
{
subProgressRecord.Activity = "Processing";
subProgressRecord.RecordType = ProgressRecordType.Processing;
subProgressRecord.StatusDescription = activity;
subProgressRecord.PercentComplete = 0;
WriteProgress(subProgressRecord);
}
break;
}
case ProvisioningMessageType.Completed:
Expand Down
2 changes: 1 addition & 1 deletion Commands/RecordsManagement/TestListItemIsRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace SharePointPnP.PowerShell.Commands.RecordsManagement
[CmdletHelp("Checks if a list item is a record",
Category = CmdletHelpCategory.RecordsManagement, SupportedPlatform = CmdletSupportedPlatform.Online)]
[CmdletExample(
Code = @"PS:> Test-PnPListItemAsRecord -List ""Documents"" -Identity 4",
Code = @"PS:> Test-PnPListItemIsRecord -List ""Documents"" -Identity 4",
Remarks = "Returns true if the document in the documents library with id 4 is a record",
SortOrder = 1)]
public class TestListItemIsRecord : PnPWebCmdlet
Expand Down
Loading