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

Commit 155fde4

Browse files
committed
Merge pull request #122 from erwinvanhunen/dev
Updated parameter handling
2 parents 5bc59a3 + 9c7605f commit 155fde4

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Commands/Branding/AddCustomAction.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ namespace OfficeDevPnP.PowerShell.Commands
1111
[Cmdlet(VerbsCommon.Add, "SPOCustomAction")]
1212
[CmdletHelp("Adds a custom action to a web", Category = CmdletHelpCategory.Branding)]
1313
[CmdletExample(Code = @"$cUIExtn = ""<CommandUIExtension><CommandUIDefinitions><CommandUIDefinition Location=""""Ribbon.List.Share.Controls._children""""><Button Id=""""Ribbon.List.Share.GetItemsCountButton"""" Alt=""""Get list items count"""" Sequence=""""11"""" Command=""""Invoke_GetItemsCountButtonRequest"""" LabelText=""""Get Items Count"""" TemplateAlias=""""o1"""" Image32by32=""""_layouts/15/images/placeholder32x32.png"""" Image16by16=""""_layouts/15/images/placeholder16x16.png"""" /></CommandUIDefinition></CommandUIDefinitions><CommandUIHandlers><CommandUIHandler Command=""""Invoke_GetItemsCountButtonRequest"""" CommandAction=""""javascript: alert('Total items in this list: '+ ctx.TotalListItems);"""" EnabledScript=""""javascript: function checkEnable() { return (true);} checkEnable();""""/></CommandUIHandlers></CommandUIExtension>""
14-
Add-SPOCustomAction -Name 'ff1591d2-8613-4a1c-b465-d647a34b2555-GetItemsCount' -Title 'Invoke GetItemsCount Action' -Description 'Adds custom action to custom list ribbon' -Group 'Microsoft.SharePoint.Client.UserCustomAction.group' -Location 'CommandUI.Ribbon' -CommandUIExtension $cUIExtn",
14+
15+
Add-SPOCustomAction -Name 'GetItemsCount' -Title 'Invoke GetItemsCount Action' -Description 'Adds custom action to custom list ribbon' -Group 'Microsoft.SharePoint.Client.UserCustomAction.group' -Location 'CommandUI.Ribbon' -CommandUIExtension $cUIExtn",
1516
Remarks = @"Adds a new custom action to the custom list template, and sets the Title, Name and other fields with the specified values. On click it shows the number of items in that list. Notice, escape quotes in CommandUIExtension.",
1617
SortOrder = 1)]
1718
public class AddCustomAction : SPOWebCmdlet

Commands/Branding/ApplyProvisioningTemplate.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,14 @@ protected override void ExecuteCmdlet()
9797
{
9898
foreach (var parameter in Parameters.Keys)
9999
{
100-
provisioningTemplate.Parameters.Add(parameter.ToString(), Parameters[parameter].ToString());
100+
if (provisioningTemplate.Parameters.ContainsKey(parameter.ToString()))
101+
{
102+
provisioningTemplate.Parameters[parameter.ToString()] = Parameters[parameter].ToString();
103+
}
104+
else
105+
{
106+
provisioningTemplate.Parameters.Add(parameter.ToString(), Parameters[parameter].ToString());
107+
}
101108
}
102109
}
103110

0 commit comments

Comments
 (0)