pnp / PnP-Sites-Core

Microsoft 365 Dev PnP Core component (.NET) targeted for increasing developer productivity with CSOM based solutions.
Other
415 stars 643 forks source link

Update Custom Action Issue #695

Open konraplo opened 8 years ago

konraplo commented 8 years ago

I have following scenario: Provisioning Template with 2 custom actions: CustomAction Name="GlobalNavScriptLink" Location="ScriptLink" Sequence="1000" Rights="" ScriptSrc="~sitecollection/SiteAssets/GlobalNavScript.js" RegistrationType="None"

CustomAction Name="JQueryScriptLink" Location="ScriptLink" Sequence="100" Rights="" ScriptSrc="~sitecollection/SiteAssets/jquery-2.1.4.js" RegistrationType="None"

After first provision it is all ok but if I try to provision it second time on the same Web - exception comes. The problem is in ObjectCustomAction->UpdateCustomAction Method. In this method it is something like this: // Otherwise we update it if (customAction.CommandUIExtension != null) { if (existingCustomAction.CommandUIExtension != parser.ParseString(customAction.CommandUIExtension.ToString())) { scope.LogPropertyUpdate("CommandUIExtension"); existingCustomAction.CommandUIExtension = parser.ParseString(customAction.CommandUIExtension.ToString()); isDirty = true; } } else { // Required to allow for a delta action to blank out the CommandUIExtension attribute existingCustomAction.CommandUIExtension = null; }

Actually existingCustomAction.CommandUIExtension = null make the existingCustomAction Object "dirty" so should by something like this: // Required to allow for a delta action to blank out the CommandUIExtension attribute if(existingCustomAction.CommandUIExtension !=null) { existingCustomAction.CommandUIExtension = null; isDirty = true; }

Which PnP repository to report the issue?

[ x] Bug [ ] Enhancement

Environment

[ ] Office 365 / SharePoint Online [ ] SharePoint 2016 [x ] SharePoint 2013

Expected or Desired Behavior

It is possible to provision the same template multiple time on the same target web.

Observed Behavior

If custom action section contains min 2 actions, by second provision the same template throw exception

Steps to Reproduce

Provision the same template with min 2 custom action multiple time on the same target web.

konraplo commented 8 years ago

Now This Bus is also in Master Branch ;)

jansenbe commented 7 years ago

Updating custom action in 2013 indeed errors out. We've seen the same in our unit testing and actually skipped 2013 in this part of the testing. This seems to be related to a product bug, not an engine issue. More research is needed