Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue setting ClientSidePage taxonomy field values from parameters empty #407

Merged
merged 2 commits into from
Jul 26, 2021

Conversation

magarma
Copy link
Contributor

@magarma magarma commented Jul 8, 2021

We are having an issue ( #406 ) when we are creating a ClientSidePage with taxonomy field values and those are comming from parameters and are empty...
for example,

...
<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2020/02/ProvisioningSchema">
  <pnp:Preferences>
    <pnp:Parameters>
      <pnp:Parameter Key="parameterTest1"></pnp:Parameter>
    </pnp:Parameters>
  </pnp:Preferences>
...
<pnp:ClientSidePage PromoteAsNewsArticle="false" PromoteAsTemplate="false" Overwrite="true" EnableComments="false" Title="Home" ContentTypeID="0x010100...."  PageName="Home.aspx" Layout="Home">
...          
<pnp:FieldValues>
            <pnp:FieldValue Key="CPLocationGeography" Value="{parameter:parameterTest1}"/>
 <pnp:FieldValues>
 </pnp:ClientSidePage>
 ...

In ObjectClientSidePage.cs there is a call...

image

This is giving an exception because the code is only checking by null and not by empty and when calling to the methdo GetTaxonomyItemByPath with an empty string is raising the exception.
"Activity failed with an error. Reason: System.ArgumentNullException: Value cannot be null. (Parameter 'path')"

image

Sending PR to check also by string empty.

Merge latest changes
…nomy item.

We have come across the case where value is "". 
This is because tokenParser despite the parameter is containing a null value, is returning "".
From there, we were getting an exception when trying to get a term with the method GetTaxonomyItemByPath and value was arriving equal to "".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants