Add-PnPFile adding column value where column name contains a spoace

Iron Contributor

Hi

 

I am trying to add a file to a library using Add-PnPFile.

 

One of the columns in the content type of the file is called Business Unit and its a Taxonomy column.

 

So I used in the Add-PnPFile :-  -Values @{Business_x0020_Unit=$businessUnit} 

Where $businessUnit is "Navigation|Root|Term1|Term1a|Term1a1"


I get the error message - Add-PnPFile : The given guid does not exist in the term store

 

Anybody any Ideas ?

 

Regards

Nigel

 

 

4 Replies

Hi,

You need to use Guid value of terms and you can find the guid value from site setting -->site administration -->term srore management --> terms set-->terms -->Unique Identifier 

 

terms.png

 

Example: 

add-pnpfile  -path C:\test.csv -values @{jobname="33e7276f-f7ae-4629-9a72-9b5a4b573f38"}

 

Hi @Manidurai Mohanamariappan

 

The documentation says you can do this :-

 

Managed Metadata (single value with path to term): -Values @{"MetadataField" = "CORPORATE|DEPARTMENTS|FINANCE"}

 

I have added this to the PnP PowerShell list of issues.

 

Regards

 

Nigel

Hi @Manidurai Mohanamariappan

 

It looks as if Set-ListItem has been updated to handle Paths as well as GUIDs but Add-PnPFile has not.

@Wobba @ErwinVanHunen.

 

Regards

 

Nigel

Yes, your correct set-pnplistitem supports both path and guid but douctment only available for set-pnplistitem and not for add-pnpfile. and i guess managed metadata path supported recently.so it will updated soon to add-pnpfile.