SharePoint 2010: The filename, directory name, or volume label syntax is incorrect

Mon, Nov 7, 2011 One-minute read

This is a peculiar little bug. When creating a List Definition, you may encounter the following error when you try to deploy:

The filename, directory name or volume label syntax is incorrect.

It took a while to track the cause, seeing as a lot of info out there info out there relates to things to do with file systems, which in this case, obviously wasn’t the cause.

The bug for me was that I had created a List Definition and called it My.List.Definition - notice the multiple periods. I wanted it to match the namespaces that we were using. It turns out that the second period trips it up. When you create a List Definition with multiple periods, the List Definition only gets the first period, e.g., My.List, whereas the Elements.xml file for the List Definition still references My.List.Definition - hence it can’t deploy properly.

To fix, edit the Elements.xml file to match the List Definition name. However, I’ve experienced knock-on issues as a result of this, for example, instances of the List Definition fail to deploy. It seems more reliable to completely delete the List Definition and recreate it with at most one period in the name.