Question

I try to generate LINQ classes for my Site Collection root in Sharepoint with this command (all in one line):

SPMetal.exe
/web:http://myserver 
/namespace:mynamespace 
/code:myfile.cs 
/parameters:mysettings.xml

The mysettings.xml looks like this:

<?xml version="1.0" encoding="utf-8"?>
<Web AccessModifier="Internal"
 xmlns="http://schemas.microsoft.com/SharePoint/2009/spmetal">
    <List Name="List1"/>
    <List Name="List2"/>
    <ExcludeOtherLists/>
</Web>

But it doesn't work, the resulting error is (roughly translated from German):

The specified file name can not be used. Perhaps already a file or directory with this name exists, or permissions are not sufficient to access the file.

And I think it can't be a file problem because:

  1. If I change the web URL to http://myserver/subsite it works pretty good, the file gets generated
  2. I can see the file being created with 0kb and after 1-2 seconds the file gets deleted and the error message is shown
  3. I have more than enough space and permissions are ok as well (see 1.)

So what am I missing? Or can't I create LINQ classes for the root Site Collection?

Was it helpful?

Solution

If you are using Visual Studio 2010 try LINQ to SharePoint extension. It allows to use nice UI wizard for generating models classes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top