Forum Discussion
Andrew van Renen
Mar 20, 2017Brass Contributor
Exception calling SPListCollection.Add: : Invalid field name. {1faa4902-9115-44b9-bba7-791441ca1d6f}
I get an exception when trying to create a new list using PowerShell (error also happens in C#). This is my PowerShell: $lists = $rootWeb.Lists
$index = $lists.Add("avrTest", "", [Microsoft.S...
Andrew van Renen
Mar 21, 2017Brass Contributor
Thanks for the reply Pieter.
The thing is, I am not creating any lookup fields. I am creating a straight-forward, unadorned, custom list, using hte Microsoft template, which should just have a Title field and the standard author and date fields.
I have no idea where the reference to SMTotalFileStreamSize is coming from.
Mar 22, 2017
That explains things a bit. I think this is an out of the bix lookup to a document library. Could it be that the document library where the field was exported from was renamed? What is the base template of the template file?
- Andrew van RenenMar 22, 2017Brass ContributorIn the create list statement, I am using [Microsoft.SharePoint.SPListTemplateType]::GenericList as the template. It is the standard MS template for a custom list (not even a library). I am not adding any fields so it should just be creating a bog-standard custom list with just a Title field.
- Mar 22, 2017It isn't the list template that I am after. The problem is the list called Docs. docs isn't standard. The site template should be something like STS#0 and can be found near the top of the xml template file created by get-pnpprovisioningtemplate
- Andrew van RenenMar 22, 2017Brass ContributorOh, okay. Now I get the drift of your questions.
So that XML fragment that I dropped in (and the associated reference to Docs) is nothing to do with me. That is one of the standard fields in SP 2016, in Microsoft's ONET.xml file.
The only reason I included that fragment is because of the error message I received, which referenced the ID of that field ("Invalid field name. {1faa4902-9115-44b9-bba7-791441ca1d6f}") (I think that is a field ID reference anyway).
I don't know anything about that field, nor do I want that field to be part of anything I am doing. All I am doing is running those 2 pieces of PowerShell to create a basic custom list. There is no other PowerShell being run and no fields being added. The error message comes from doing the Create List operation (calling the .Lists.Add() method)