Skip to main content
added 9 characters in body
Source Link
Ganesh Sanap - MVP
  • 47.3k
  • 22
  • 32
  • 64

Meanwhile you can shorten up your code by setting:

$DisplayName = "Email" $PNPField = Add-PnPField -List $List -DisplayName $DisplayName -InternalName $DisplayName -Type Lookup -AddToDefaultView Set-PnPField -List $List -Identity $PNPField.Id -Values @{LookupList= "a66ff40f-ceca-4f6b-a523-7fe32a97ea11"; LookupField="Email"}

$DisplayName = "Email"
$PNPField = Add-PnPField -List $List -DisplayName $DisplayName -InternalName $DisplayName -Type Lookup  -AddToDefaultView
Set-PnPField -List $List -Identity $PNPField.Id -Values @{LookupList= "a66ff40f-ceca-4f6b-a523-7fe32a97ea11"; LookupField="Email"}

sourceSource: https://sposcripts.com/add-sharepoint-columns-with-powershell/#Add_Lookup_Column

Meanwhile you can shorten up your code by setting

$DisplayName = "Email" $PNPField = Add-PnPField -List $List -DisplayName $DisplayName -InternalName $DisplayName -Type Lookup -AddToDefaultView Set-PnPField -List $List -Identity $PNPField.Id -Values @{LookupList= "a66ff40f-ceca-4f6b-a523-7fe32a97ea11"; LookupField="Email"}

source: https://sposcripts.com/add-sharepoint-columns-with-powershell/#Add_Lookup_Column

Meanwhile you can shorten up your code by setting:

$DisplayName = "Email"
$PNPField = Add-PnPField -List $List -DisplayName $DisplayName -InternalName $DisplayName -Type Lookup  -AddToDefaultView
Set-PnPField -List $List -Identity $PNPField.Id -Values @{LookupList= "a66ff40f-ceca-4f6b-a523-7fe32a97ea11"; LookupField="Email"}

Source: https://sposcripts.com/add-sharepoint-columns-with-powershell/#Add_Lookup_Column

Source Link

Meanwhile you can shorten up your code by setting

$DisplayName = "Email" $PNPField = Add-PnPField -List $List -DisplayName $DisplayName -InternalName $DisplayName -Type Lookup -AddToDefaultView Set-PnPField -List $List -Identity $PNPField.Id -Values @{LookupList= "a66ff40f-ceca-4f6b-a523-7fe32a97ea11"; LookupField="Email"}

source: https://sposcripts.com/add-sharepoint-columns-with-powershell/#Add_Lookup_Column