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 [splistitemcollection]

A class of the Microsoft.SharePoint namespace, SPListItemCollection represents a collection of SPListItem objects.

0
votes
0answers
18 views

SP Group Cannot Be Found

I encountered an error in the following method based on the log error as follows: Group cannot be found. at Microsoft.SharePoint.SPGroupCollection.GetByID(Int32 id) at Site.Subsite.ERMS....
0
votes
0answers
15 views

SharePoint Group Cannot Be Found error when retrieving SPListItem

Error log captured the error Group Cannot Be Found at this part of the code. private void GetTreeView(PRDConfig.System SelectedSystem = PRDConfig.System.PRD) { try { using (...
2
votes
3answers
1k views

csom iterate sharepoint list item and update field

I have list with 10000 record and want to update field "Business" whose value is AAA to BBB. for this I need to iterate each list items and update. Below is my code. ClientContext clientContext = new ...
3
votes
2answers
146 views

Why sporadically I get a null reference exception on items.count

SPList List = SPContext.Current.Site.RootWeb.Lists.TryGetList(listname); SPQuery camlQuey = new SPQuery(); camlQuery.RowLimit=10; SPListItemCollection items = List.GetItems(camlQuery); if (items....
0
votes
1answer
355 views

Get all list items in provided-hosted add-in (SharePoint Online)

I am trying to get all items of a list and show the Title. Although i can get a list and show its Title i cannot get its items. It seems i use the suggested code but the ListItemCollection object has ...
2
votes
1answer
221 views

C# - How to Combine two SharePoint Lists

I am trying to combine two SharePoint lists into one so I can return items from two separate lists as one entity. I have multiple Objects but I haven't found a good way to combine them no matter ...
0
votes
1answer
287 views

Is it possible to change the default order of SPList.Items?

In my code, I am simply using SPList.Items which is returning all items (SPListItemCollection) with default sorting order (ascending order by Created date). I know that I can use CAML Query or some ...
0
votes
1answer
326 views

Group By SPListItem in SharePoint SPListItemCollection

I have custom list. with calculated column Department Group. Department group column takes first left letter of title columns in uppercase. using SPListItemCollection I'm able to get all items. but ...
1
vote
2answers
816 views

How to find the item ID of a list in SharePoint using REST?

At some point in time, I want to update a specific Item in a list. I Know that I have to use the REST call to update a specific item. Below is my URL. http://cloudapps.cctspl.com/sites/...
1
vote
0answers
156 views

How to get distinct users from SPList in c# from list having people and group column?

My Team Discussion list having the column "AppreciatedTo" of type People and Group. Whereas I need to fetch the distinct users in current year (created date also there) in visual webpart in c#. Adding ...
1
vote
1answer
1k views

Difference between SPList.GetDataTable and SPList.GetItems(SPQuery).GetDataTable

I've few questions as below: Can some one please explain me the difference between SPList.GetDataTable and SPList.GetItems(SPQuery).GetDataTable methods? Explain the meaning of the parameters for ...
0
votes
1answer
290 views

SP07 - How to get SPListItem Author and Last Editor

I want to get author and editor on SP ListItem: With this Page_load Code : SPQuery myQuery = new SPQuery(); myQuery.Query = "<Where><Eq><FieldRef Name='ID'/><Value Type='Text'&...
1
vote
1answer
490 views

Iterating SPList.GetItems(SPQuery) very slow and times out

I have a SharePoint 2013 Custom List. It has 3 MMS columns, 3 User Columns and 3 or 4 DateTime columns and a Choice Column and 1 or 2 columns of type Text. This list currently has around 2000 items. I ...
0
votes
1answer
552 views

SPListItemCollection to Dictionary<string, SPListItem>

Rather than repeatedly query a SharePoint list for information I need, I wanted to create a dictionary from an SPListItemCollection (where the dictionary key is the "Title" value of each SPListItem, ...
0
votes
1answer
232 views

SPListItemCollection.GetDataTable() , For choice fields its adding extra string “;#” in the datatable

SPListItemCollection collListItems = list.GetItems(query); dataTable = collListItems.GetDataTable(); I am using above for getting listitemcollection into datatable. In the list I have choice column ...
12
votes
4answers
8k views

Iterating through SPListItemCollection - why foreach is bad?

I have seen in different places that we should not use foreach to iterate through SPListItemCollection, but I can't find explanation, why? E.g. http://de.slideshare.net/ghurlman/sharepoint-...
5
votes
2answers
3k views

Converting ListItemCollection to List<t> efficiently

I am getting items from a sharepoint list, like below, and then appending these to a list of the object type. I can't help but feel this is a slow way to populate this list, looping through each list ...
10
votes
2answers
624 views

Efficient way to retrieve all list items

I am retrieving all items from list containing around 4000 items. But it seems to take longer time to fetch all items which is ~15 to ~22 seconds. Is there any best way to fetch all items from list in ...
6
votes
3answers
3k views

Change sort order in returned ItemsCollection

I am fetching a collection of items from a list using a CAML query. The returned items are then populated in my custom HMTL table. There is, however, another HTML table for which I need the same ...
0
votes
1answer
2k views

How to bind tree view with XMLdatasource dynamically in c#

I have a scenario where I have a SPListItemCollection of SharePoint 2013 and I have to bind tree view with XMLDataSource. I have to add nodes to XML and iterate to add child nodes also but all these ...
0
votes
3answers
671 views

Best way to cache large SPList for users with security trimming

The scenario: There are performance problems around viewing a large list with several thousand items. I want to cache it to reduce the query to the database. Users need to be able to see this list, ...
0
votes
1answer
568 views

Where does a list item go when it is deleted using Server Object Model?

Assumptions: I have a custom SharePoint list with 2 items in it. In one case i delete one item from the list manually and check the recycle bin,here i find the deleted item. Now in the second case i ...
2
votes
1answer
2k views

Setting Managed metadata field

I am trying to update a managed metadata field but I get an error saying `Property 'ListItemCollectionPosition' cannot be found on this object'$spQuery.<< $site1 = Get-SPSite mysite [System....
2
votes
2answers
3k views

Convert DataTable to SPListItemCollection

Consider the following code:- SPListItemCollection collListItems = emp_info.GetItems(query); dt = collListItems.GetDataTable(); Now i want to convert the dt object back to SPListItemCollection ...
2
votes
1answer
852 views

serialize SPListItemCollection through WCF sharepoint 2013

My question is simple, how to get ( or retrieve ) json serialized SPListItemCollection through WCF service ? tried to use NewtonSoft for .Net, but it's throw an exception when try to serialized it. I ...
13
votes
1answer
489 views

How does calculated field value form in pageInfo

Using paging in XsltListViewWebPart there are some rules, which form pageInfo attributes and which we can see in the query string. Here is the short example, what I mean. Paged=TRUE&p_SortColumn=...
1
vote
1answer
634 views

Bestway to store and manipulate SPListItemCollection results

I get a SPListItemCollection in my program. I use this collection to show the items in a DataGridView display. I need to filter items based on a requirement. But .Add() or Delete() does changes to ...
0
votes
1answer
762 views

SPListItemCollection slow

I have a list with over 150k records. I'm doing a filter to get only 1 record via CAML, only sort by a particular column, and this is it takes at least 15 seconds for me to have this return, which is ...
1
vote
6answers
7k views

How to get count of list items in SharePoint 2010 if count is more than List View Threshold value?

I have more than 10000 items in my list. I have default List View Threshold value as 5000.I want to get the count of items programmatically. How can I get the count? I think here SPListItemCollection....
23
votes
3answers
33k views

CAML query limitation of values in IN operator

I have less than 5000 items in my library. I want to get 530 items by ids. So I am using following query. <Where> <In> <FieldRef Name="ID" /> <Values> <...
0
votes
2answers
2k views

ItemEventReceiver - ItemDeleting not working with a document library and referencing list

I have a custom list that has a GUID column which refers to the UniqueId of a document in a document library. Every time I upload a document, it should add an entry in this list and populate the ...
0
votes
4answers
292 views

SPListItem.Delete() has some issues

I have a list which consist of more than 5600 items. In my application i will search all the items from particular date range by using SPquery. As the result of the SPQuery, the splistitem collection ...
1
vote
2answers
6k views

How to get SPListItemCollection from a SPFolder?

I am making a SharePoint 2010 visual web part, and I want to recursively iterate through all files in a document library which has nested folders. I can get a SPListItemCollection for all items and ...
2
votes
3answers
3k views

Proper way to evaluate/get status of boolean field when looping through SP List with code

What is the best way to do this when looping a list? I have tried to evaluate it with something like this but it wont let me evaluate bool as an "if" condition if (item["ShowTitle"] == true) //do ...
0
votes
1answer
434 views

Double value in URL from SPListItemCollection result

I have a basic list which I am using to generate a "Quick Links" menu WebPart. It looks ok but for some reason the URL field (of URL type) when rendered renders html that looks like this: <a ...
25
votes
2answers
17k views

SPList.Add() vs SPList.AddItem() SharePoint 2010

Using some test code i found out that SPList.AddItem() executes slight faster then SPList.Add() - does anyone know why is it so ? DateTime start = DateTime.Now; SPList ...
1
vote
0answers
625 views

SPListItemCollection.EnsureListItemsData seems to deadlock

I'm trying out multithreading with the SP2010 Object Model and I've run into some weirdness. My application currently does the following: Opens an SPSite and uses AllWebs.WebsInfo to build a Guid[] ...
4
votes
4answers
15k views

Get value of Hyperlink field in Sharepoint 2010 list item

I'm trying to get the value of a field of type "Hyperlink or Image" (currently set to "Hyperlink" in the column settings that is being returned as part of a Sharepoint 2010 ListItem. I'm using the ...
0
votes
2answers
14k views

SPListItemCollection Get ItemCount with rowlimit

I am filtering a list in caml SPQuery oQuery = new SPQuery(); oQuery.Query = "<OrderBy><FieldRef Name='FullName' /></OrderBy><Where><Contains><FieldRef Name='...
0
votes
2answers
2k views

Get all SPLists for a site collection

I feel like I'm very close on this one. I know how to get the root site collection from this: How can I get the root site collection from SPContext.Current? I've been messing around with ...
0
votes
2answers
904 views

get a list of items inside a folder in document library

I built the following code so far: SPWeb web = __Context.Web; Guid listGuid = new Guid(__Context.ListId); SPList myList = web.Lists[listGuid]; SPListItem myItem = ...
2
votes
0answers
278 views

Is my Object Casting Model acceptable?

I'm creating a SharePoint application, and am trying some new things to create what amounts to an API for Data Access to maintain consistency and conventions. I haven't seen this before, and that ...
1
vote
3answers
12k views

Getting specific SPFile from document library

I have a Document Library called "x" with file named "y". I am curious what the best way to get the SPFile object for the specified SPListItem. Currently I am using this: SPContext.Current.Web....
1
vote
1answer
2k views

When to use List<SPList> vs SPListCollection?

If I have to grab numerous lists which I have the name, URL or Guid of, should I use web.Lists and return the entire SPListCollection or grab the specific ones I need via web.Lists[Guid] and place ...
1
vote
3answers
1k views

is this causing memory leaks?

I have a couple of utility functions that help with querying lists and wanted to see if they I wrote them would cause either memory leaks or cause the client code to try to access already disposed ...
2
votes
1answer
1k views

Search Optimization on SPListItemCollection

I have an SPListItemCollection (Thread Discussion Collection) that consists of almost 20,000 items. Each SPListItem (Thread Discussion) on the SPListItemCollection contains a sub SPListItem(Thread ...
3
votes
3answers
3k views

GridView lookups displaying as “id;#value”

I am using an ASP.net gridview. The datasource is SPList.Items.GetDataTable(). The gridview is working fine; however, lookup and multilookup columns display as "id;#value". Is there any way to just ...