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
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
3 changes: 0 additions & 3 deletions Commands/Admin/GetTenantAppCatalogUrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ namespace SharePointPnP.PowerShell.Commands
[CmdletExample(Code = @"PS:> Get-PnPTenantAppCatalogUrl", Remarks = "Returns the url of the tenant scoped app catalog site collection", SortOrder = 1)]
public class GetTenantAppCatalogUrl : PnPCmdlet
{
[Parameter(Mandatory = false, HelpMessage = "The key of the value to retrieve.")]
public string Key;

protected override void ExecuteCmdlet()
{
var settings = Microsoft.SharePoint.Client.TenantSettings.GetCurrent(ClientContext);
Expand Down
4 changes: 2 additions & 2 deletions Commands/Extensibility/NewExtensibilityHandlerObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

namespace SharePointPnP.PowerShell.Commands.Extensibility
{
[Cmdlet(VerbsCommon.New, "PnPExtensbilityHandlerObject")]
[Cmdlet(VerbsCommon.New, "PnPExtensibilityHandlerObject")]
[CmdletHelp("Creates an ExtensibilityHandler Object, to be used by the Get-SPOProvisioningTemplate cmdlet",
Category = CmdletHelpCategory.Features,
OutputType=typeof(ExtensibilityHandler))]
[CmdletExample(
Code = @"
PS:> $handler = New-PnPExtensbilityHandlerObject -Assembly Contoso.Core.Handlers -Type Contoso.Core.Handlers.MyExtensibilityHandler
PS:> $handler = New-PnPExtensibilityHandlerObject -Assembly Contoso.Core.Handlers -Type Contoso.Core.Handlers.MyExtensibilityHandler
PS:> Get-PnPProvisioningTemplate -Out NewTemplate.xml -ExtensibilityHandlers $handler",
Remarks = @"This will create a new ExtensibilityHandler object that is run during extraction of the template",
SortOrder = 1)]
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.22.1801.0")]
[assembly: AssemblyFileVersion("2.22.1801.0")]
[assembly: AssemblyVersion("2.23.1802.0")]
[assembly: AssemblyFileVersion("2.23.1802.0")]
[assembly: InternalsVisibleTo("SharePointPnP.PowerShell.Tests")]
2 changes: 2 additions & 0 deletions Commands/SharePointPnP.PowerShell.Commands.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@
<Compile Include="ClientSidePages\SetClientSideText.cs" />
<Compile Include="ClientSidePages\SetClientSideWebPart.cs" />
<Compile Include="Enums\SiteWebTemplate.cs" />
<Compile Include="SiteDesigns\SetSiteDesign.cs" />
<Compile Include="SiteDesigns\AddSiteScript.cs" />
<Compile Include="SiteDesigns\AddSiteDesign.cs" />
<Compile Include="SiteDesigns\RevokeSiteDesignRights.cs" />
Expand Down Expand Up @@ -549,6 +550,7 @@
<Compile Include="ClientSidePages\ClientSidePageUtilities.cs" />
<Compile Include="ClientSidePages\SetClientSidePage.cs" />
<Compile Include="ClientSidePages\AddClientSideText.cs" />
<Compile Include="SiteDesigns\SetSiteScript.cs" />
<Compile Include="WebParts\AddClientSideWebPart.cs" />
<Compile Include="ClientSidePages\GetAvailableClientSideComponents.cs" />
<Compile Include="ClientSidePages\RemoveClientSidePage.cs" />
Expand Down
4 changes: 2 additions & 2 deletions Commands/SiteDesigns/AddSiteScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ namespace SharePointPnP.PowerShell.Commands
SortOrder = 1)]
public class AddSiteScript : PnPAdminCmdlet
{
[Parameter(Mandatory = true, HelpMessage = "The title of the site design")]
[Parameter(Mandatory = true, HelpMessage = "The title of the site script")]
public string Title;

[Parameter(Mandatory = false, HelpMessage = "The description of the site design")]
[Parameter(Mandatory = false, HelpMessage = "The description of the site script")]
public string Description;

[Parameter(Mandatory = true, HelpMessage = "A JSON string containing the site script")]
Expand Down
120 changes: 120 additions & 0 deletions Commands/SiteDesigns/SetSiteDesign.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#if !ONPREMISES
using Microsoft.Online.SharePoint.TenantAdministration;
using Microsoft.SharePoint.Client;
using SharePointPnP.PowerShell.CmdletHelpAttributes;
using SharePointPnP.PowerShell.Commands.Base;
using SharePointPnP.PowerShell.Commands.Base.PipeBinds;
using SharePointPnP.PowerShell.Commands.Enums;
using System;
using System.Linq;
using System.Management.Automation;

namespace SharePointPnP.PowerShell.Commands
{
[Cmdlet(VerbsCommon.Set, "PnPSiteDesign", SupportsShouldProcess = true)]
[CmdletHelp(@"Updates a Site Design on the current tenant.",
Category = CmdletHelpCategory.TenantAdmin,
SupportedPlatform = CmdletSupportedPlatform.Online)]
[CmdletExample(
Code = @"PS:> Set-PnPSiteDesign -Identity 046e2e76-67ba-46ca-a5f6-8eb418a7821e -Title ""My Updated Company Design""",
Remarks = "Updates an existing Site Design and sets a new title.",
SortOrder = 1)]
[CmdletExample(
Code = @"PS:> $design = Get-PnPSiteDesign -Identity 046e2e76-67ba-46ca-a5f6-8eb418a7821e
PS:> Set-PnPSiteDesign -Identity $design -Title ""My Updated Company Design""",
Remarks = "Updates an existing Site Design and sets a new title.",
SortOrder = 2)]
public class SetSiteDesign : PnPAdminCmdlet
{
[Parameter(Mandatory = true, HelpMessage = "The guid or an object representing the site design")]
public TenantSiteDesignPipeBind Identity;

[Parameter(Mandatory = false, HelpMessage = "The title of the site design")]
public string Title;

[Parameter(Mandatory = false, HelpMessage = "An array of guids of site scripts")]
public GuidPipeBind[] SiteScriptIds;

[Parameter(Mandatory = false, HelpMessage = "The description of the site design")]
public string Description;

[Parameter(Mandatory = false, HelpMessage = "Specifies if the site design is a default site design")]
public SwitchParameter IsDefault;

[Parameter(Mandatory = false, HelpMessage = "Sets the text for the preview image")]
public string PreviewImageAltText;

[Parameter(Mandatory = false, HelpMessage = "Sets the url to the preview image")]
public string PreviewImageUrl;

[Parameter(Mandatory = false, HelpMessage = "Specifies the type of site to which this design applies")]
public SiteWebTemplate WebTemplate;

[Parameter(Mandatory = false, HelpMessage = "Specifies the version of the design")]
public int Version;


protected override void ExecuteCmdlet()
{
var design = Tenant.GetSiteDesign(ClientContext, Identity.Id);
ClientContext.Load(design);
ClientContext.ExecuteQueryRetry();
if (design != null)
{
var isDirty = false;
if (MyInvocation.BoundParameters.ContainsKey("Title"))
{
design.Title = Title;
isDirty = true;
}
if (MyInvocation.BoundParameters.ContainsKey("Description"))
{
design.Description = Description;
isDirty = true;
}
if (MyInvocation.BoundParameters.ContainsKey("IsDefault"))
{
design.IsDefault = IsDefault;
isDirty = true;
}
if (MyInvocation.BoundParameters.ContainsKey("PreviewImageAltText"))
{
design.PreviewImageAltText = PreviewImageAltText;
isDirty = true;
}
if (MyInvocation.BoundParameters.ContainsKey("PreviewImageUrl"))
{
design.PreviewImageUrl = PreviewImageUrl;
isDirty = true;
}
if(MyInvocation.BoundParameters.ContainsKey("WebTemplate"))
{
design.WebTemplate = ((int)WebTemplate).ToString();
isDirty = true;
}
if(MyInvocation.BoundParameters.ContainsKey("Version"))
{
design.Version = Version;
isDirty = true;
}
if(MyInvocation.BoundParameters.ContainsKey("SiteScriptIds"))
{
design.SiteScriptIds = SiteScriptIds.Select(t => t.Id).ToArray();
isDirty = true;
}
if (isDirty)
{
Tenant.UpdateSiteDesign(design);
ClientContext.ExecuteQueryRetry();
WriteObject(design);
}
WriteObject(design);
} else
{
WriteError(new ErrorRecord(new ItemNotFoundException(), "SITEDESIGNNOTFOUND", ErrorCategory.ObjectNotFound, Identity));
}

}
}
}
#endif
78 changes: 78 additions & 0 deletions Commands/SiteDesigns/SetSiteScript.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#if !ONPREMISES
using Microsoft.Online.SharePoint.TenantAdministration;
using Microsoft.SharePoint.Client;
using SharePointPnP.PowerShell.CmdletHelpAttributes;
using SharePointPnP.PowerShell.Commands.Base;
using SharePointPnP.PowerShell.Commands.Base.PipeBinds;
using System.Management.Automation;

namespace SharePointPnP.PowerShell.Commands
{
[Cmdlet(VerbsCommon.Set, "PnPSiteScript", SupportsShouldProcess = true)]
[CmdletHelp(@"Updates an existing Site Script on the current tenant.",
Category = CmdletHelpCategory.TenantAdmin,
SupportedPlatform = CmdletSupportedPlatform.Online)]
[CmdletExample(
Code = @"PS:> Set-PnPSiteScript -Identity f1d55d9b-b116-4f54-bc00-164a51e7e47f -Title ""My Site Script""",
Remarks = "Updates an existing Site Script and changes the title.",
SortOrder = 1)]
[CmdletExample(
Code = @"PS:> $script = Get-PnPSiteScript -Identity f1d55d9b-b116-4f54-bc00-164a51e7e47f
PS:> Set-PnPSiteScript -Identity $script -Title ""My Site Script""",
Remarks = "Updates an existing Site Script and changes the title.",
SortOrder = 2)]
public class SetSiteScript : PnPAdminCmdlet
{
[Parameter(Mandatory = true, HelpMessage = "The guid or an object representing the site script")]
public TenantSiteScriptPipeBind Identity;

[Parameter(Mandatory = false, HelpMessage = "The title of the site script")]
public string Title;

[Parameter(Mandatory = false, HelpMessage = "The description of the site script")]
public string Description;

[Parameter(Mandatory = false, HelpMessage = "A JSON string containing the site script")]
public string Content;

[Parameter(Mandatory = false, HelpMessage = "Specifies the version of the site script")]
public int Version;

protected override void ExecuteCmdlet()
{
var script = Tenant.GetSiteScript(ClientContext, Identity.Id);
if (script != null)
{
var isDirty = false;

if (MyInvocation.BoundParameters.ContainsKey("Title"))
{
script.Title = Title;
isDirty = true;
}
if (MyInvocation.BoundParameters.ContainsKey("Description"))
{
script.Description = Description;
isDirty = true;
}
if (MyInvocation.BoundParameters.ContainsKey("Content"))
{
script.Content = Content;
isDirty = true;
}
if (MyInvocation.BoundParameters.ContainsKey("Version"))
{
script.Version = Version;
isDirty = true;
}
if (isDirty)
{
Tenant.UpdateSiteScript(script);
ClientContext.ExecuteQueryRetry();
WriteObject(script);
}
}
}
}
}
#endif
4 changes: 2 additions & 2 deletions Documentation/Add-PnPSiteScript.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Accept pipeline input: False
```

### -Description
The description of the site design
The description of the site script

```yaml
Type: String
Expand All @@ -53,7 +53,7 @@ Accept pipeline input: False
```

### -Title
The title of the site design
The title of the site script

```yaml
Type: String
Expand Down
15 changes: 1 addition & 14 deletions Documentation/Get-PnPTenantAppCatalogUrl.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ Retrieves the url of the tenant scoped app catalog.
## SYNTAX

```powershell
Get-PnPTenantAppCatalogUrl [-Key <String>]
[-Connection <SPOnlineConnection>]
Get-PnPTenantAppCatalogUrl [-Connection <SPOnlineConnection>]
```

## EXAMPLES
Expand All @@ -26,18 +25,6 @@ Returns the url of the tenant scoped app catalog site collection

## PARAMETERS

### -Key
The key of the value to retrieve.

```yaml
Type: String
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False
```

### -Connection
Optional connection to be used by cmdlet. Retrieve the value for this parameter by eiter specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

Expand Down
2 changes: 2 additions & 0 deletions Documentation/MSDN/PnP-PowerShell-Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,12 +405,14 @@ Cmdlet|Description|Platform
**[Add&#8209;PnPSiteDesign](Add-PnPSiteDesign.md)** |Creates a new Site Design on the current tenant.|SharePoint Online
**[Get&#8209;PnPSiteDesign](Get-PnPSiteDesign.md)** |Retrieve Site Designs that have been registered on the current tenant.|SharePoint Online
**[Remove&#8209;PnPSiteDesign](Remove-PnPSiteDesign.md)** |Removes a Site Design|SharePoint Online
**[Set&#8209;PnPSiteDesign](Set-PnPSiteDesign.md)** |Updates a Site Design on the current tenant.|SharePoint Online
**[Get&#8209;PnPSiteDesignRights](Get-PnPSiteDesignRights.md)** |Returns the principals with design rights on a specific Site Design|SharePoint Online
**[Grant&#8209;PnPSiteDesignRights](Grant-PnPSiteDesignRights.md)** |Grants the specified principals rights to use the site design.|SharePoint Online
**[Revoke&#8209;PnPSiteDesignRights](Revoke-PnPSiteDesignRights.md)** |Revokes the specified principals rights to use the site design.|SharePoint Online
**[Add&#8209;PnPSiteScript](Add-PnPSiteScript.md)** |Creates a new Site Script on the current tenant.|SharePoint Online
**[Get&#8209;PnPSiteScript](Get-PnPSiteScript.md)** |Retrieve Site Scripts that have been registered on the current tenant.|SharePoint Online
**[Remove&#8209;PnPSiteScript](Remove-PnPSiteScript.md)** |Removes a Site Script|SharePoint Online
**[Set&#8209;PnPSiteScript](Set-PnPSiteScript.md)** |Updates an existing Site Script on the current tenant.|SharePoint Online
**[Get&#8209;PnPStorageEntity](Get-PnPStorageEntity.md)** |Retrieve Storage Entities / Farm Properties.|SharePoint Online
**[Remove&#8209;PnPStorageEntity](Remove-PnPStorageEntity.md)** |Remove Storage Entities / Farm Properties.|SharePoint Online
**[Set&#8209;PnPStorageEntity](Set-PnPStorageEntity.md)** |Set Storage Entities / Farm Properties.|SharePoint Online
Expand Down
2 changes: 2 additions & 0 deletions Documentation/MSDN/TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,14 @@
### [Add-PnPSiteDesign](Add-PnPSiteDesign.md)
### [Get-PnPSiteDesign](Get-PnPSiteDesign.md)
### [Remove-PnPSiteDesign](Remove-PnPSiteDesign.md)
### [Set-PnPSiteDesign](Set-PnPSiteDesign.md)
### [Get-PnPSiteDesignRights](Get-PnPSiteDesignRights.md)
### [Grant-PnPSiteDesignRights](Grant-PnPSiteDesignRights.md)
### [Revoke-PnPSiteDesignRights](Revoke-PnPSiteDesignRights.md)
### [Add-PnPSiteScript](Add-PnPSiteScript.md)
### [Get-PnPSiteScript](Get-PnPSiteScript.md)
### [Remove-PnPSiteScript](Remove-PnPSiteScript.md)
### [Set-PnPSiteScript](Set-PnPSiteScript.md)
### [Get-PnPStorageEntity](Get-PnPStorageEntity.md)
### [Remove-PnPStorageEntity](Remove-PnPStorageEntity.md)
### [Set-PnPStorageEntity](Set-PnPStorageEntity.md)
Expand Down
2 changes: 2 additions & 0 deletions Documentation/MSDN/TenantAdministration-category.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ Cmdlet|Description|Platform
**[Add&#8209;PnPSiteDesign](Add-PnPSiteDesign.md)** |Creates a new Site Design on the current tenant.|SharePoint Online
**[Get&#8209;PnPSiteDesign](Get-PnPSiteDesign.md)** |Retrieve Site Designs that have been registered on the current tenant.|SharePoint Online
**[Remove&#8209;PnPSiteDesign](Remove-PnPSiteDesign.md)** |Removes a Site Design|SharePoint Online
**[Set&#8209;PnPSiteDesign](Set-PnPSiteDesign.md)** |Updates a Site Design on the current tenant.|SharePoint Online
**[Get&#8209;PnPSiteDesignRights](Get-PnPSiteDesignRights.md)** |Returns the principals with design rights on a specific Site Design|SharePoint Online
**[Grant&#8209;PnPSiteDesignRights](Grant-PnPSiteDesignRights.md)** |Grants the specified principals rights to use the site design.|SharePoint Online
**[Revoke&#8209;PnPSiteDesignRights](Revoke-PnPSiteDesignRights.md)** |Revokes the specified principals rights to use the site design.|SharePoint Online
**[Add&#8209;PnPSiteScript](Add-PnPSiteScript.md)** |Creates a new Site Script on the current tenant.|SharePoint Online
**[Get&#8209;PnPSiteScript](Get-PnPSiteScript.md)** |Retrieve Site Scripts that have been registered on the current tenant.|SharePoint Online
**[Remove&#8209;PnPSiteScript](Remove-PnPSiteScript.md)** |Removes a Site Script|SharePoint Online
**[Set&#8209;PnPSiteScript](Set-PnPSiteScript.md)** |Updates an existing Site Script on the current tenant.|SharePoint Online
**[Get&#8209;PnPStorageEntity](Get-PnPStorageEntity.md)** |Retrieve Storage Entities / Farm Properties.|SharePoint Online
**[Remove&#8209;PnPStorageEntity](Remove-PnPStorageEntity.md)** |Remove Storage Entities / Farm Properties.|SharePoint Online
**[Set&#8209;PnPStorageEntity](Set-PnPStorageEntity.md)** |Set Storage Entities / Farm Properties.|SharePoint Online
Expand Down
Loading