I've this code bellow
OfertaParticulares
Connect-PnPOnline -Url https://test.sharepoint.com/sites/test/Negocio/OfertaParticulares -Credentials (Get-Credential)
$listName="Páginas"
$fieldName="LookUp"
$lookupListTitle="Páginas"
$lookupList=Get-PnPList -Identity $lookupListTitle
$field = Get-PnpField -List $listName -Identity $fieldName
[xml]$schemaXml=$field.SchemaXml
$schemaXml.OuterXml
$schemaXml.Field.Attributes["List"].Value = "{" + $lookupList.Id + "}"
$schemaXml.Field.Attributes["ShowField"].Value = "Title"
Set-PnPField -List $listName -Identity $fieldName -Values @{SchemaXml=$schemaXml.OuterXml}
And the result is:
<Field Type="LookupMulti"
DisplayName="TítuloDetalhe"
Required="FALSE"
EnforceUniqueValues="FALSE"
List="{d97620a4-959b-44d8-9111-a9eeb8158382}"
ShowField="Title"
Mult="TRUE"
Sortable="FALSE"
UnlimitedLengthInDocumentLibrary="FALSE"
RelationshipDeleteBehavior="None"
ID="{db74d50c-df97-47e8-812a-f1bbd31327cd}"
SourceID="{d97620a4-959b-44d8-9111-a9eeb8158382}"
StaticName="T_x00ed_tuloDetalhe"
Name="T_x00ed_tuloDetalhe"
ColName="int15"
RowOrdinal="0"
Version="5"
Group="" />
I'm trying to insert the result in ComunicacoesDeNegocio like this:
Connect-PnPOnline -Url https://test.sharepoint.com/sites/test/Normativo/ComunicacoesDeNegocio -Credentials (Get-Credential)
$xml = '<Field Type="LookupMulti"
DisplayName="TítuloDetalhe"
Required="FALSE"
EnforceUniqueValues="FALSE"
List="{d97620a4-959b-44d8-9111-a9eeb8158382}"
ShowField="Title"
Mult="TRUE"
Sortable="FALSE"
UnlimitedLengthInDocumentLibrary="FALSE"
RelationshipDeleteBehavior="None"
ID="{db74d50c-df97-47e8-812a-f1bbd31327cd}"
SourceID="{d97620a4-959b-44d8-9111-a9eeb8158382}"
StaticName="T_x00ed_tuloDetalhe"
Name="T_x00ed_tuloDetalhe" ColName="int15"
RowOrdinal="0"
Version="5" Group="" />'
Add-PnPFieldFromXml -List "Páginas" -FieldXml $xml
When I see the property of the column "Get information from" (Obter informações de) is empty as you can see:
What could be the problem?
