0

Hello SharePoint Peoples,

So I am trying to figure out how to use a lot of the PnP Commands. Getting hung up on Set-PnPField. I have a column already created, and I can Get-PnPField and read it's properties. The property I am interested in editing is DependantLookupInternalNames which look to be the related columns that will be added to a given list if the Lookup column is added to a list.

I know that you can:

$siteField = Get-PnPField -Identity ThisField
if ($siteField) {
    [xml]$schemaXml = $siteField.SchemaXml
    $schemaXml.Field.ShowField = "NewShowField"
    Set-PnPField -Identity ThisField-Values @{SchemaXml=$schemaXml.OuterXml}
}

BUT the DependantLookupInternalNames does not show up in the Xml, and if I try:

$dlin = New-Object System.Collections.Generic.List[String]
$dlin.Add("OtherField1")
$dlin.Add("OtherField2")
$values = @{LookupField = "NewShowField"; DepentantLookupInternalNames = $dlin}

I get the

WARNING: No property 'DepentantLookupInternalNames' found on this field. Value will be ignored. WARNING: No property 'LookupField' found on this field. Value will be ignored.

The property names should be correct as that is what Visual Studio Code tells me the property names are when I break point my code there. Is there a reference library for SharePoint Object properties?

Thanks in advance!

  • where did you find about 'DependantLookupInternalNames ' there is no reference to this anywhere...let me know if i am missing something? – Siddharth Vaghasia Jul 24 at 7:17
  • @SiddharthVaghasia When I break point my code after I use Get-PnPField, I can see it as a property Generic.List in the variable description. I can open up the property and see any Columns I added by hand through SPO. – Daniel W Jul 24 at 11:25
0

You can check the FieldLookup properties, the property named "DependentLookupInternalNames".

And you can check the code of the Set-PnPField command.

https://github.com/SharePoint/PnP-PowerShell/blob/master/Commands/Fields/SetField.cs

  • Thanks for the reference material there. So after reviewing it, looks as though this field is NOT editable via PowerShell PnP commands if I am looking at it correctly? – Daniel W Jul 24 at 11:32
  • Did you try to use CSOM with PowerShell? – LZ_MSFT Jul 25 at 1:26

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.