Questions tagged [linq-to-sharepoint]
27 questions
5
votes
3 answers
Linq to SharePoint throwing null reference exception
In our SharePoint 2010 project we are using Linq to SharePoint to get a list of ConfigurationItems. On our testing environments we never had issues fetching data from this list. On our production environment we are now sometimes (we cannot find a…

ChristiaanV
- 5,401
- 3
- 32
- 42
5
votes
1 answer
SPMetal: How to override it to use internal name instead of “Display Name”
So I am using SPmetal tool to generate data classes to use LINQ to SharePoint.
A feature of the tool is aliasing the site column by its Display name.
How can I override SPMetal setting to use Internal name or static name?

Shankarooni
- 207
- 3
- 11
4
votes
1 answer
Extending linq to sharepoint for Publishing HTML fields
I've created a partial class to extend the default spmetal class to handle publishing html fields. As outlined here:
Extending the Object-Relational Mapping
Snippet from public partial class RelatedLinksItem : Item, ICustomMapping:
///…

Gerard
- 75
- 1
- 8
3
votes
3 answers
Correct MultiChoice Values in LINQ to SharePoint Query
I am using a LINQ to SharePoint query to return items from a SharePoint list.
var myOpenTasksQuery = from myTasks in tasks
where myTasks.TaskStatus != TaskStatus.Completed
select myTasks
However, the…

Tangiest
- 43,737
- 24
- 82
- 113
2
votes
5 answers
LINQ to Sharepoint InsertOnSubmit Question
For example I have a list called Product and it has 3 columns, ProductName (which is the Title), ProductPrice and ProductType.
ProductName is a string
ProductPrice is a currency (double)
ProductType is a LookUp on ProductTypes List
Normally…

Raymund
- 7,684
- 5
- 45
- 78
2
votes
5 answers
matching string to item ids in LINQ
I have a string:
strCheckedCategories = "2;"
an EntityList representing a SharePoint list, with item IDs from 1 to 21:
EntityList vendorSearches =
dataContext.GetList("Vendor Searches");
a LINQ query…

LFurness
- 669
- 2
- 10
- 21
1
vote
1 answer
LINQ to Sharepoint - User field
I'm using LINQ to Sharepoint and I've got big problem with saving entity which have user field. SPMetal generated me User field like string property, so I try tu do something like this:
SomeEntity e = new SomeEntity() { ..., User = user.ID, ...…

Michal
- 1,324
- 2
- 16
- 38
1
vote
0 answers
Is there a way to use SPMetal generated classes together with a WCF service application?
I generated entity classes with spmetal using the serialization parameter (set to "unidirectional"). However, when I use those classes as return value for a WCF method, I get the following error:
System.ServiceModel.CommunicationException was…

binford
- 1,655
- 1
- 18
- 36
1
vote
1 answer
LINQ Query results and string methods
First of all let me apologize for the wall of code. Basically, I have two two queries against Sharepoint lists. The code seems to work great if I comment a couple of lines. Here is the code:
Global:
private string mUserName = "";
// Entity classes…

Corey
- 450
- 3
- 9
1
vote
2 answers
complicated query with multi-lookups
I am trying to get the items of one list where any of the multi-lookup values is contained in the result of another query.
The situation is this: I am building a webpart with which users can make reports ("melding") using a set of sharepoint…

Wuolennaj
- 192
- 2
- 10
1
vote
0 answers
Web service 404 always due complex types
I'm having problem passing some complex data in a call, one type is HTML, another one is stringify Json.
REQ_Description = HTML
REQ_Services = JSON.stringify(SomeData)
Here is my code
SERVER
Interface
[WebGet(UriTemplate =…

Joao Livio
- 89
- 1
- 1
- 13
1
vote
2 answers
Sharepoint event receiver and linq to sharepoint
I have a sandboxed solution and access some lists with Linq-to-Sharepoint. Now I attached an event receiver to the list type 101 because I have to restrict some files uploaded to picture libraries. This works fine.
But now my Linq-to-Sharepoint…

Marc
- 6,749
- 9
- 47
- 78
1
vote
0 answers
Generate Sharepoint LINQ classes with SPMetal and ContentType
I have a list MyList based on ContentType MyContentType in Sharepoint.
Now I try to generate the LINQ classes with SPMetal but the class for ContentType is created twice basically.
XML config for SPMetal

Marc
- 6,749
- 9
- 47
- 78
0
votes
2 answers
When does SPMetal generate EntityRef properties for lookup fields?
I have a defined a content type called SPVideoDataItem containing those two fields:

binford
- 1,655
- 1
- 18
- 36
0
votes
1 answer
Optimizing LINQ to Sharepoint
I have three lists on Sharepoint 2010 and I have working code that gets the lists and relates them. My problem is that it takes around 15 seconds to load my page. I am a rank beginner with LINQ to Sharepoint and LINQ in general. MY question is: Is…

Corey
- 450
- 3
- 9