Questions tagged [linq]

Language Integrated Query, LINQ, is a .NET Framework component used for native data querying

Language Integrated Query, LINQ, is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages.

Questions with the linq tag regards development of linq in SharePoint.

More to read: http://en.wikipedia.org/wiki/Linq

121 questions
5
votes
3 answers

Using LINQ to select SPListItems and load a SPGridView

Is there a way to run this LINQ statement var items = from SPListItem li in listSettings.Items where li["WebID"].ToString() == SPContext.Current.Web.ID.ToString() orderby li["Title"].ToString() select li; and simply bind it to my…
David Lozzi
  • 7,372
  • 5
  • 29
  • 50
3
votes
1 answer

Dynamic LINQ to SharePoint and Projection

How to build dynamic LINQ to SharePoint expression like this(but store "Bill", "Sam" in array): // listing 1 // SPEntityModelDataContext generated with SPMetal using (var db = new SPEntityModelDataContext("http://sharepoint/")) { var res =…
Alex
  • 233
  • 1
  • 2
  • 8
3
votes
2 answers

Frustrated! Linq to SharePoint, choice values, losing spaces

I'm using Linq to grab my SharePoint data (used CKS tools to create the class). I've been having some headaches with using it especially around choice fields. All of the choice values are converted into an enum object and all choice values lose…
David Lozzi
  • 7,372
  • 5
  • 29
  • 50
3
votes
2 answers

Value does not fall within the expected range. LINQ

I have a very strange situation, exactly same site and code on server and developer machine. On server everything works fine, but on developer I encounter such a problem (details below). It happens if I assing a child class to parent, like: void …
christof
  • 360
  • 6
  • 18
2
votes
2 answers

Linq to SharePoint and localization

I'm working on a project which has localized site definitions. Now for one part, I wanted to use spmetal to generate a datacontext. Works, but I noticed the generated class retrieves lists by their name. I don't really understand why Microsoft would…
Jasper
  • 1,264
  • 5
  • 18
  • 48
2
votes
5 answers

Quick and effective way to do an inner join using LINQ to Sharepoint on 2 tables

I can't seem to find a guide which explains how to do an inner join on lookup fields using LINQ. Most of the guides require converting the EntityLists to custom objects so you can join on non lookup fields. Here is the SQL I want to try and…
JL01
  • 1,219
  • 5
  • 22
  • 36
1
vote
0 answers

Linq query multiple master tables

I have a question related to LINQ queries in SharePoint 2010. I have few master lists - 1> Team (ID, Name) 2> Lifecycle (ID, Name) 3> Technology (ID, Name) 4> Users (ID, Name) Then there is a mapping table having ID's of all the above & some…
1
vote
1 answer

Lookup field Join not working

I am new to sharepoint and i am using Linq to Sharepoint in my project. I have two Lists in TestSite. Details are as below Department DepartmentName Single line of text ManagerId Person or Group IsActive Choice …
Stark
  • 161
  • 1
  • 1
  • 10
1
vote
1 answer

how to linq query spfield to spuser

Here is my code. SPUser approver = mySite.EnsureUser(approverId); var selectedItems = listItems.Cast().Where(p => p.Fields["WF_Approver"] == approver); my list items field "WF_Approver" is field type of person or group. my approver is…
cranfan
  • 129
  • 1
  • 3
  • 14
1
vote
1 answer

How to get all webs in Farm or WebApplication with one Linq to SharePoint query?

Is it possible to get all webs in Farm or WebApplication with one Linq to SharePoint query? Now my data context constructor takes only takes one argument, and that is one web. This way I need to loop though all webs, which feels clumsy and…
Tim
  • 801
  • 1
  • 12
  • 27
0
votes
2 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
  • 131
  • 2
  • 12
0
votes
1 answer

How can I update the record in sharepoint 2010 using linq?

I am unable to update the record in SharePoint 2010 using new linq feature. follwoing in my code please review it. AbsentTrackingSystemEntitiesDataContext ctx = new AbsentTrackingSystemEntitiesDataContext(spWeb.Url); …
Basant B. Pandey
  • 447
  • 1
  • 8
  • 21
0
votes
1 answer

How to access Yes/No field of Sharepoint List using Linq?

I have one list in which there is field with the datatype of Yes/No. I am trying to retrieve data of that field but it is giving me following error : System.InvalidCastException: Specified cast is not valid. at …
Stark
  • 161
  • 1
  • 1
  • 10
0
votes
1 answer

linq to sharepoint and excessive cpu usage issue

our project is using linq to sharepoint , its working well the only problem we are facing is the extra CPU usage its taking , even if only two or three users concurrently accesses the local testing server on which the application is deployed , the…
user8189
  • 159
  • 2
  • 8
0
votes
1 answer

Dynamic LINQ to SharePoint

This question starts here: Dynamic LINQ to SharePoint and Projection how to build dynamic LINQ to SharePoint expression like this(but store "Bill", "Sam" in array): // Listing 1 // SPEntityModelDataContext generated with SPMetal using (var db = new…
Alex
  • 233
  • 1
  • 2
  • 8
1
2