[BUG] User field not taken on ContactFieldControl webpart
@jansenbe is already working on this.
Since May 28, 2021.
- Dominant language
- C#
- Stars
- 259
- Forks
- 161
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 1
Description
Thank you for reporting a bug. We appreciate your feedback - to help the team to understand your needs, please complete the below template to ensure we have the necessary details to assist you. Thanks!
Problem Area
[x] Page Transformation: Error during the use of page transformation from PnP PowerShell
[ ] Page Transformation: Error during the use of page transformation from .Net
[ ] Page Transformation: Page is not looking correct after transformation
[ ] Modernization Scanner: something went wrong...
Expected or Desired Behavior
Using the Powershell command
ConvertTo-PnPPage -Identity $page.FieldValues["ID"]
-PublishingPage
-TargetWebUrl $targetSiteUrl
-PublishingTargetPageName $targetFileName
-Connection $sourceConnection
-KeepPageCreationModificationInformation
-PageLayoutMapping "C:\Temp\custompagelayoutmapping-xxx.xml"
-WebPartMappingFile "C:\Temp\webpartmapping-xxx.xml"
-PostAsNews
-Overwrite
-SkipItemLevelPermissionCopyToClientSidePage
-LogSkipFlush
-SkipUserMapping
-LogType File
-CopyPageMetadata
-LogFolder "c:\temp"
-ClearCache
with custompagelayoutmapping-xxx.xml (relevant section)
<Field Name="xxxContact" TargetWebPart="Microsoft.SharePoint.Portal.WebControls.ContactFieldControl, Microsoft.SharePoint.Portal, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Row="1" Column="2">
<Property Name="Title" Type="string" Functions="StaticString({xxxContactDescription})" />
<Property Name="Description" Type="string" />
<Property Name="Frametype" Type="string" />
<Property Name="PartImageLarge" Type="string" />
<Property Name="ID" Type="string" />
<Property Name="ContactLoginName" Type="string" />
</Field>
and webpartmapping-xxx.xml (relevant section)
<!-- Contact web part -->
<WebPart Type="Microsoft.SharePoint.Portal.WebControls.ContactFieldControl, Microsoft.SharePoint.Portal, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" CrossSiteTransformationSupported="true">
<Properties>
<Property Name="IsIncluded" Type="bool"/>
<Property Name="Dir" Type="string"/>
<Property Name="PartImageSmall" Type="string"/>
<Property Name="PartImageLarge" Type="string"/>
<Property Name="IsIncludedFilter" Type="bool"/>
<Property Name="CacheTimeout" Type="integer" />
<Property Name="ContactLoginName" Type="string" Functions="LookupPerson({ContactLoginName})"/>
</Properties>
<Mappings Selector="UserExistsSelector({PersonEmail})">
<Mapping Name="ValidUser" Default="true">
<ClientSideWebPart Type="People" Order="10" JsonControlData="{"serverProcessedContent":{"htmlStrings":{},"searchablePlainTexts":{"title":"{Title}","persons[0].name":"{PersonName}","persons[0].email":"{PersonEmail}"},"imageSources":{},"links":{}},"dataVersion":"1.2","properties":{"layout":1,"persons":[{"id":"{PersonEmail}","upn":"{PersonUPN}","role":"{PersonRole}","department":"{PersonDepartment}","phone":"{PersonPhone}","sip":"{PersonSip}"}]}}"/>
</Mapping>
<Mapping Name="InvalidUser" Default="false">
<ClientSideText Order="10" Text="User with ID {ContactLoginName} could not be found. Mapping to People web part was skipped."/>
</Mapping>
</Mappings>
</WebPart>
Desired behaviour would be
i) accepting a user field as input for the ContactFieldControl, e.g. <Field Name="xxxContact" TargetWebPart="Microsoft.SharePoint.Portal.WebControls.ContactFieldControl ...
ii) resolving the user from the user field input and fill the desired modern "people" web part accordingly
Observed Behavior
i) using any user field as input yields "Microsoft.SharePoint.Portal.WebControls.ContactFieldControl, Microsoft.SharePoint.Portal, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c is not added for field [Fieldname] because the field value was empty and the RemoveEmptySectionsAndColumns flag was set".
- xxxContact is not empty (the mapping
<Field Name="xxxContact" TargetFieldName="xxxKontakt" Functions="" />is working) - same for any other user e.g. Editor
- as a workaround, I used
<Field Name="Title" TargetWebPart="Microsoft.SharePoint.Portal.WebControls.ContactFieldControl ...just to avoid the incorrect "field value was empty" error that is thrown on any user field. Then, any of these lines
<Property Name="ContactLoginName" Type="string" Functions="{xxxContact}" />
<Property Name="ContactLoginName" Type="string" Functions="StaticString({xxxContact})" />
<Property Name="ContactLoginName" Type="string" Functions="ToAuthors({xxxContact})" />
do not work.
The next line is the only way I got the People webpart produced and filled with an user:
<Property Name="ContactLoginName" Type="string" Functions="StaticString('i:0#.f|membership|xx.xx@xx.de')" /> - btw, the flag -RemoveEmptySectionsAndColumns for Powershell ConvertTo-PnPPage does not make sense here, because it is already the default behaviour. There should be a flag like -KeepEmptySectionsAndColumns
- and a very last question: is there a way to use a multi value people field to fill the People webpart (Powershell)?
PnP PowerShell version:
ModuleType Version Name
Manifest 1.5.0 PnP.PowerShell
Output from PowerShell session:
PS C:\Users\xxx> C:\Users\xxx\OneDrive - xxx\Code\Sharepoint\convert-to-modern2.ps1
Connecting to https://xxx.sharepoint.com/sites/intranet/aktuelles/archiv
Gathering news articles... 8 items found.
[1/8] Processing xxx-Mai-2021.aspx... OK
Report saved as: c:\temp\Page-Transformation-Report-27.05.2021-14-36-54.md
Done.
Report:
Modernization Summary Report
| Date | Duration | Source Page | Target Page Url | Status |
|---|---|---|---|---|
| 27.05.2021 14:36:54 | 00:00:20 | /aktuelles/archiv/Seiten/xxx-Mai-2021.aspx | /SitePages/xxx-Mai-2021.aspx | Successful with 1 warnings and 0 non-critical errors |
Warnings during transformation
| Date | Source Page | Operation | Message |
|---|---|---|---|
| 27.05.2021 14:36:57 | /aktuelles/archiv/Seiten/xxx-Mai-2021.aspx | Publishing Page analyzer | Target web part Microsoft.SharePoint.Portal.WebControls.ContactFieldControl, Microsoft.SharePoint.Portal, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c is not added for field Editor because the field value was empty and the RemoveEmptySectionsAndColumns flag was set |
| 27.05.2021 14:37:14 | /aktuelles/archiv/Seiten/xxx-Mai-2021.aspx | Article page handling |
Steps to Reproduce
See above
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.