1

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:

enter image description here

What could be the problem?

0

Problem is cause you are creating cross-site reference and it is NOT supported.

https://test.sharepoint.com/sites/test/Negocio/OfertaParticulares https://test.sharepoint.com/sites/test/Normativo/ComunicacoesDeNegocio

You must have lists in the same Web for using of LookUp Columns.

  • There is another way to solve this problem? I can't have the lists in the same Web. – KmDroid Jan 15 at 15:05
  • There are some third-parts applications which can be used for Cross-Site LookUp Columns, try google it. Tomorrow i can look for you too. If this is correct, make this as answer please :) – Zdeněk Vinduška Jan 15 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.