SPImport + custom user fields = Value cannot be null, parameter name = g

A few days ago we had to export and import list items from a certain list, because we used item level security and when your items go beyond 5k item count than you will hit the threshold. Most of the advice that you find on the internet is “increase the threshold”.

Yes you can do that, but ask yourself, why is it 5000? Well this has something to do with the backend of the SharePoint system (which is SQL of course). SQL handles row locks up to a certain amount. More than 5000 and it does a lock on the entire SQL table, which is not good…

So back to our story, we redesigned the structure and used folders instead and see where the security was common. Ok, threshold limit fixed but we still needed to move the items to the folder.

Because we didn’t want to just copy the items and deleting the source item, we used SPExport and SPImport instead. Benefit here is that the entire item is exported, deleted and imported again on the correct location. Very important was the ID, this was a production environment and the mails that already were sent and maybe some lookups pointing to the list. So keeping the ID the same was very important.

Now it didn’t take long before we reached our first error.


After a quick search on the internet we find that when you have custom user fields defined via the elements.xml file like so:

   1: <;Field 

   2: ID='{A77F7435-0F70-44CD-9D4A-C10520E2E0B2}' Description='' 

   3: Name='LoginName' DisplayName='LoginName' StaticName='LoginName' Type='User' 

   4: Group='Meligo'/>

Now the code above will work and all is good in SharePoint land, until you are going to export / import an item.

I wanted to know from where the error comes and after some searching it in a certain area of SharePoint called with reflector we find this:




As you can see a check is being done if the field contains a lookup list and if that lookup list is equal to “UserInfo”. Great this is step 1 in solving the problem.

So some key attributes are missing from the schema. To fix the error above, you need to add in the schema of the field: ‘List=”UserInfo” ‘ .

Next, the export without compression gives you the directory below



In this Directory the “UserGroup.xml” is the one that we should look at. this should contain as many user nodes as there are user fields:


As you can see the “<User” tag is created for each user field in the item, when it is filled in. If it is not filled in, than that userfield is being skipped.

Now we should have 3 user fields here. At the moment this is not the case.

Still, this wasn’t enough. We’ve added the ‘List=”UserInfo”’ to the field schema and pushed the update to all the lists fields. But the user field was still looked at as a Lookup field instead of a user field.

It’s because the field is listed in the manifest.xml but there is no user field correctly parsed to it.

Well it turned out that the ‘mult=”false/true” ‘ needed to be added as well. Only then the field is being considered as an user field.

Good luck hunting for that one Smile

After we did the 2 changes in the field schema the import worked like a charm again.

Also if you get the error / warning “cannot find user with {ID}” than your user isn’t listed in the UserInfo list.

The User Information List can be accessed (Only if you’re admin) via the browser by navigating to /_catalogs/users/simple.aspx from your site. (Ex: http://YourSiteUrl/_catalogs/users/simple.aspx)


    1. hey I mean that it’s an OOTB field but provisioned via manifest file. If the field schema is incorrect for a user field you will run in these issues.

Leave a Reply

Your email address will not be published. Required fields are marked *