Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [linq]

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

1
vote
1answer
127 views

get the data from SharePoint list in between dates using linq

i getting the date range from sql, i am passing the date range in linq query as below to display employee time-offs in that pay-period. var query = from l in leaves where (l....
0
votes
1answer
267 views

Get items from a list using Microsoft.Sharepoint.Linq

I am trying to get the items from a Sharepoint list with no luck. My code resembles the following: using (DataContext data = new DataContext(SPContext.Current.Web.Url)) { var typeList= ...
0
votes
1answer
58 views

IEnumerable<SPListItem>and LINQ Error

In the following code, the "FirstOrDefault" function returns a SPlistItem; it is a valid item. However, the "ToList" function throws an exception of "System.NullReferenceException". Why does ...
1
vote
0answers
209 views

SharePoint Online - Some fields are not loaded in List Item CSOM

1) I am getting list items from a list by CAML query in ListItemCollection objects of Max 5000 items 2) I am pushing each ListItemCollection into a List of ListItem to enable the capability of ...
0
votes
2answers
177 views

caml or linq to get data from list

I am new with sharepoint development. I read more articles to read data from sharepoint list. I find Caml and linq i want to know what is the diff between Caml and linq to learn
0
votes
1answer
58 views

Is there any way to know why SPMetal is not generating classes?

Running SPMetal on Sharepoint site or any of its subsites returns object reference not set to an instance of an object Is there a log or any way to find out what's going wrong? I cant seem to ...
1
vote
1answer
137 views

Get choices from Choice field type on FieldCollection object?

Is it possible to get the available options on a choice field from the FieldCollection object? I am using a LINQ statement and have no issues getting other properties such as internal name, the field ...
1
vote
2answers
85 views

Linq To SharePoint entities not counting all items in a document library

I want to count then number of documents in a sharepoint document library in which contains about 100 thousand items. Using the code below, the exact number of documents are returned: SPList oList = ...
1
vote
2answers
502 views

Faster way to get distinct field values?

I have a web part, and I am trying to populate a drop-down control with the unique/distinct values from a particular field in a list. Unfortunately, due to the nature of the system, it is a text ...
1
vote
2answers
502 views

Filter list with Linq and lookupvalue

I've a list with a lookup column named Agents. I want to filter it by using the Lookup Value in "Agents" with Linq but I don't understand how to be able to compare the lookup Value to a string. the ...
0
votes
1answer
251 views

Use LINQ GroupBy with SPListItemsCollection

I have a SharePoint list containing some items. I would like to apply grouping to the items using LINQ, preferably with .GroupBy method. This is the list of fields that the list item is consisted of: ...
0
votes
1answer
95 views

SharePoint Linq ToList ArgoumentException

I'm using SharePoint 2010 Foundation with LINQ for SharePoint list. I've generate my DataContext using spmetal command. Now I'm trying to access data but I have this error: ArgoumentException ...
3
votes
1answer
5k views

Loading list items with CSOM ClientContext.Load: performance with LINQ

We have code like this: List list = clientContext.Web.Lists.GetByTitle("TestLib"); ListItemCollection items = list.GetItems(query); clientContext.Load(items, its => its....
0
votes
1answer
455 views

How to join two sharepoint list data using CAML or LINQ?

I have two lists: Doctors DoctorDetails In list #2 I have a lookup from list #1 i.e. on Doctor Name. Now I want to fetch data on the basis of doctor name as filter from both lists. How can I ...
1
vote
2answers
451 views

Create a dynamic WHERE clause with LINQ to SharePoint

I have a custom application where the user can select multiple (13) parameters to select data from a SharePoint list. To achieve this, I want to use LINQ to query this data from SharePoint. The ...
1
vote
0answers
181 views

SPMetal Error : An item with the same key has already been added

I am using the following command to generate entity class for Linq to SharePoint. spmetal.exe /web:http://mywebname:port /code:D:\CustomerClass.cs I am getting Error "An item with the same key has ...
0
votes
1answer
640 views

Using DataBase First Approach with EF in SharePoint?

I have seen here and there that Entity framework and Linq works with SharePoint. But can we use Entity framework Database first approach in SharePoint? http://cdn.rssbus.com/help/RS3/ado/...
0
votes
1answer
281 views

Unable to return Microsoft.Sharepoint.Client.File object Names filtered by extension

I'm attempting to retrieve a set of File objects filtered by extension. The following code works correctly (without the filter). FolderCollection productModelFolders = _clientContext.Web.Lists....
0
votes
1answer
54 views

Document Library Attachment Retrieval. LINQ vs CAML

In a particular project I am required to retrieve corresponding attachments to a request submitted by a user. On one page the live requests are displayed with links to the attachments. The project ...
-1
votes
1answer
2k views

ItemUpdated Event Receiver how to change element from one list to secound list

I have got two lists. I must do synchronize this list, but one have got only 3 columns, and secound list have got 3 columns too, but have got more columns with hidden value. I done synchronizing ...
0
votes
0answers
108 views

Simplest way to connect a Visual Studio SharePoint App to my external Database

Hi all new to developing for SharePoint. As the title indicates I want to connect my Visual Studio SharePoint App that I have created to my external database. I have created the app and it works in ...
1
vote
1answer
1k views

Use GroupBy on ListItemCollection using CSOM

I am trying to do a GroupBy on a bunch of items that I have retrieved using CSOM and when I try do a foreach loop to go through them I get method not supported exception. List contactsList = context....
0
votes
1answer
16 views

External Content type linq error

I have a list with an externa content type. I am tring to fetch the element by server side code, but i get this exception: Microsoft.BusinessData.Infrastructure.BdcException This is my ...
0
votes
1answer
57 views

Access parent site list data via LINQ from subsite

I have an SP 2010 web part that access list data using LINQ. The data and the web part currently live on the top-level site. Would I be able to easily access that data in a different web part from a ...
0
votes
1answer
215 views

LINQ query taking long time

Following query i write it returns me 1400 records. and below line taking much time. 1.5 second taken by count = quer != null ? quer.Count() : 0; and 2 sec taken by candidateList = quer.Skip((...
0
votes
2answers
3k views

Linq to SharePoint 2013

Is it recommended to use Linq to SharePoint while developing projects for SharePoint 2013? or this became an old trend?
0
votes
1answer
619 views

How to check sharepoint list date column is empty?

How to check sharepoint list date column is empty? I want to check in back end code. IEnumerable<DataRow> x = from laptop in dtList.AsEnumerable() join ...
0
votes
0answers
338 views

dataservicequeryexception is unhandled by usercode

var serviceUrl = "/_vti_bin/listdata.svc"; var context = new listservice.TestingEnvironmentDataContext(new Uri(serviceUrl)); context.Credentials = System.Net.CredentialCache.DefaultCredentials; var ...
0
votes
2answers
985 views

Linq get Distinct or first from multiple group

Ok, I'm not understanding something here with what I am attempting to query here. I have a list like the following. Title Subject Content Date ...
0
votes
4answers
6k views

OfType<SPListItem>() says SPListItemCollection does not contain a definition for OfType()

I'm using Linq to SharePoint rather than CAML to query list data from SharePoint. See the code I have written: SPList productsList = SPContext.Current.Web.Lists["Products"]; IEnumerable<SPListItem&...
1
vote
0answers
844 views

LINQ DataSource DataContext: Could not load type

I made a very simple webpart with a grid view and and a LINQ to SQL data context object to surface some employee information for a phone list. I was able to databind the grid view directly to LINQ ...
2
votes
2answers
519 views

Linq to sharepoint: Cannot find corresponding storage member

I'm trying to use Linq to Sharepoint to get a list and i got this message: Cannot find corresponding storage member for member Title I've tried some solution but nothing worked. And i don't know ...
1
vote
0answers
28 views

LINQ to SP Problem

I have a following var resultsMarks = from mItem in MItemList.ToList() select new { ScienceGroup = mItem.ScienceGroup, ArtsGroup = mItem.ArtsGroup, CommerceGroup = mItem.CommerceGroup, ...
1
vote
1answer
745 views

Will searching SPWebApplication.Sites with Linq need to be diposed?

Situation: I only have the full URL of an image in our farm & no knowledge of where it comes from other than being in the web application so I need to locate the site/web/list/item segments. ...
0
votes
1answer
543 views

LINQ in SharePoint to order listitems

I have tried the following in CAML but it does not seem to be returning them sorted SPQuery query = new SPQuery(); query.Query = "<Query><OrderBy><FieldRef Name='Sequence ...
0
votes
1answer
52 views

Shortcut to use LINQ

http://msdn.microsoft.com/en-us/library/ff742311.aspx Based on the link above you have to make a detour before you can use syntax code LINQ for SharePoint. If you have to do the same approach for ...
0
votes
1answer
169 views

How to get list items same values in each two list items to display in 3rd list using with caml query

How can I write one caml query to get items from two lists joined on empid? will you please anybody give me help with suitable caml query or even otherwise possible code. Note: There is no lookup ...
0
votes
1answer
253 views

get list item versions in linq to sharepoint

How can i access last approved list-items in linq to sharepoint. Actually I want equivalent of this statement in linq to sharepoint if (item.Versions[index].Level == SPFileLevel.Published)
0
votes
1answer
457 views

get count from groupby query of linq to xml

I need to group the elements in the xml by Article_x0020_Tags . Here I get the items from the sharepoint pages library , which has a custom column called "article Tags" which is a managed metadata ...
0
votes
1answer
1k views

linq query for lookup list column error - query uses unsupported elements

I'm trying to return the list item ID (s.ID), and the ID of a lookup column (s.VendorID). I get the following error: The query uses unsupported elements, such as references to more than one list, ...
0
votes
0answers
754 views

Values missing for dependent lookup column from parent list when using linq

Situation I have 2 site content types defined that are deployed as a site feature: Customer Name Address Order Value There is a second web feature that deploys a list to the root site for ...
1
vote
0answers
410 views

Linq to Sharepoint throws System.IndexOutOfRangeException

I have used entity class generated from SPMetal to retrieve data from sharepoint list. Frequently I am getting the below error on the sharepoint page and not able to do anything in the site. This ...
0
votes
1answer
73 views

Linq & SharePoint 2007

Morning all, I'm aware that LINQ was packaged with SharePoint 2010 but I'm wondering on the feasability of tools such as Linqpad with SharePoint 2007. I've recently inherited a SharePoint 2007 farm ...
1
vote
0answers
103 views

LINQPad cannot connect to remote Sharepoint machine

I have been working with the SP2010 OData interface to get some quick and dirty sheets as required by colleagues. Now I need to use some additional methods (f.e.:GroubBy) and therefore need to use ...
3
votes
2answers
189 views

Sharepoint 2013 Dispose in linq

I'm wondering if this needs to be disposed or if it's a bad method to get the title of a web. var currentWebApp = SPContext.Current.Site.WebApplication; IEnumerable<SPSite> allTeamSites = ...
0
votes
1answer
562 views

Why would linq to sharepoint ever return null list items?

I am getting a null reference exception that I can't pin down. By process of elimination using a variety of assumptions I've narrowed it down to a single variable, a linq iteration variable, like so: ...
0
votes
2answers
484 views

how to update Listdata with Linqpad and wcf?

I am a lazy person, therefor I like to not scratch up a small concsole application if I don't need to. I'd like to update a few listitems via Linqpad. I can query the items just fine, but how do I ...
0
votes
1answer
355 views

Is SPMetal and LINQ to SharePoint worth using?

I have recently run into a number of issues with SPMetal and LINQ to SharePoint that is making me wonder if it is worth it. In what cases does it make sense to use SPMetal and in what cases does it ...
0
votes
1answer
628 views

Problem with join two lists by linq

I wanna join two list and fill drop down list by specific column but i have error in join query note:c.user_id is lookup field my code lst.DataSource = (from c in dc.Complainant ...
0
votes
1answer
92 views

Understanding SPMetal and Linq

If I generate .cs file using SPMetal for my site and then use it in Visual Studio to develop web part using Linq. And later on I create a new list in my site, will I need to generate .cs file again?