How do I remove LOV values using ISHRemote?

Hi,

I am having difficulty with a LOV element and some duplicate values that I accidentally added and want to remove.

I have tried to create ISHRemote script to remove them but don't understand how to set the value for -LovValueId argument

$lovValues = Get-IshLovValue -IshSession $ishSession -LovId "DMARKETPLACE"
foreach($lovValue in $lovValues)
{
   Remove-IshLovValue -LovId $lovValue.LovId -LovValueId $lovValue.IshRef
}

Any advice appreciated,

Regards,

Ann

emoji
  • Hi Ann,

    The first step is to have a look at Get-Help, it holds a sample of creating and immediately removing that created value

    Get-Help Remove-IshLovValue -Examples
    
    NAME
        Remove-IshLovValue
        
    SYNOPSIS
        The Remove-IshLovValue cmd-let removes the values that are passed through the pipeline or determined via provided parameters from the specified List of Values
        
        
        ----------  EXAMPLE 1  ----------
        
        $ishSession = New-IshSession -WsBaseUrl "https://example.com/InfoShareWS/" -IshUserName "username" -IshUserPassword  "userpassword"
        $lovValue = Add-IshLovValue -IshSession $ishSession -LovId "DILLUSTRATIONTYPE" -Label "New image type" -Description "New image type description"
        Remove-IshLovValue -IshSession $ishSession -LovId $lovId -LovValueId $lovValue.IshRef
        
        Add and remove a value

    The below code section is the most flat solution, so immediate parameters (no variables). Again creating, listing and removing a value.

    # New-IshSession ...
    Add-IshLovValue -LovId DILLUSTRATIONTYPE -Label 'Conceptual Art' -Description 'Conceptual Art Description'
    Get-IshLovValue -LovId DILLUSTRATIONTYPE
    Get-IshLovValue -LovId DILLUSTRATIONTYPE -LovValueId VILLUSTRATIONTYPECONCEPTUALART
    Remove-IshLovValue -LovId DILLUSTRATIONTYPE -LovValueId VILLUSTRATIONTYPECONCEPTUALART

    Hope this helps,
    Dave

    emoji