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

%3CLINGO-SUB%20id%3D%22lingo-sub-90846%22%20slang%3D%22en-US%22%3EAdd-PnPFile%20adding%20column%20value%20where%20column%20name%20contains%20a%20spoace%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-90846%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20add%20a%20file%20to%20a%20library%20using%20Add-PnPFile.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOne%20of%20the%20columns%20in%20the%20content%20type%20of%20the%20file%20is%20called%20Business%20Unit%20and%20its%20a%20Taxonomy%20column.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20I%20used%20in%20the%20Add-PnPFile%20%3A-%26nbsp%3B%20-Values%20%40%7BBusiness_x0020_Unit%3D%24businessUnit%7D%26nbsp%3B%3C%2FP%3E%3CP%3EWhere%20%24businessUnit%20is%20%22Navigation%7CRoot%7CTerm1%7CTerm1a%7CTerm1a1%22%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EI%20get%20the%20error%20message%20-%20Add-PnPFile%20%3A%20The%20given%20guid%20does%20not%20exist%20in%20the%20term%20store%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnybody%20any%20Ideas%20%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%3C%2FP%3E%3CP%3ENigel%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-91131%22%20slang%3D%22en-US%22%3ERe%3A%20Add-PnPFile%20adding%20column%20value%20where%20column%20name%20contains%20a%20spoace%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-91131%22%20slang%3D%22en-US%22%3E%3CP%3EYes%2C%20your%20correct%20set-pnplistitem%20supports%20both%20path%20and%20guid%20but%20douctment%20only%20available%20for%26nbsp%3B%3CSPAN%3Eset-pnplistitem%20and%20not%20for%20add-pnpfile.%20and%20i%20guess%26nbsp%3Bmanaged%20metadata%20path%20supported%20recently.so%20it%20will%20updated%20soon%20to%20add-pnpfile.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-91126%22%20slang%3D%22en-US%22%3ERe%3A%20Add-PnPFile%20adding%20column%20value%20where%20column%20name%20contains%20a%20spoace%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-91126%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F3058%22%20target%3D%22_blank%22%3E%40Manidurai%20Mohanamariappan%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20looks%20as%20if%20Set-ListItem%20has%20been%20updated%20to%20handle%20Paths%20as%20well%20as%20GUIDs%20but%20Add-PnPFile%20has%20not.%3C%2FP%3E%3CP%3E%40Wobba%20%40ErwinVanHunen.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENigel%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-91124%22%20slang%3D%22en-US%22%3ERe%3A%20Add-PnPFile%20adding%20column%20value%20where%20column%20name%20contains%20a%20spoace%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-91124%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F3058%22%20target%3D%22_blank%22%3E%40Manidurai%20Mohanamariappan%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20documentation%20says%20you%20can%20do%20this%20%3A-%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EManaged%20Metadata%20(single%20value%20with%20path%20to%20term)%3A%20-Values%20%40%7B%22MetadataField%22%20%3D%20%22CORPORATE%7CDEPARTMENTS%7CFINANCE%22%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20added%20this%20to%20the%20PnP%20PowerShell%20list%20of%20issues.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENigel%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-91076%22%20slang%3D%22en-US%22%3ERe%3A%20Add-PnPFile%20adding%20column%20value%20where%20column%20name%20contains%20a%20spoace%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-91076%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EYou%20need%20to%20use%20Guid%20value%20of%20terms%20and%20you%20can%20find%20the%20guid%20value%20from%20%3CSTRONG%3Esite%20setting%20--%26gt%3Bsite%20administration%20--%26gt%3Bterm%20srore%20management%20--%26gt%3B%20terms%20set--%26gt%3Bterms%20--%26gt%3BUnique%20Identifier%3C%2FSTRONG%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F17838iCE53397C2F80E2FF%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22terms.png%22%20title%3D%22terms.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EExample%3A%26nbsp%3B%3C%2FP%3E%3CP%3Eadd-pnpfile%20%26nbsp%3B-path%20C%3A%5Ctest.csv%20-values%20%40%7Bjobname%3D%2233e7276f-f7ae-4629-9a72-9b5a4b573f38%22%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Regular 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.