Skip to main content
6 votes
Accepted

item[ID] doesn't return item[ID]

get the item in SPlistitem and then get value from it. For ex = Splistitem item = list.getitembyid(1); var x = item.ID;
Muskan's user avatar
  • 886
6 votes

item[ID] doesn't return item[ID]

In SharePoint ID is a counter and always incremental. Even though you delete item, it is never going to occupy the blank ID. It always keeps on incrementing. Also list.Items always return ...
ThinkB4Code's user avatar
  • 2,980
5 votes
Accepted

properties.ListItem.Url inside an event receiver is working well for discussion board items, while it fails for custom list (url will end with _.000 )

I never use the SPListItem.Url property, as list items don't really have a user browsable URL. They only have an ID, and the list that contains them has a display form (list forms may also change over ...
Evariste's user avatar
  • 9,731
5 votes

Item level permission in SharePoint 2013

Yes, this is possible in SharePoint 2013. You can follow the below steps: Go to the list where you want to assign item level permissions. Select the Item in which you have to provide the permissions....
Anand's user avatar
  • 1,755
4 votes
Accepted

Update attachment of list item using rest api is failing

Unfortunately there is no API to overwrite the list attachment, so you need to delete the attachment first before uploading it. Try the below sample code: function checkFileExists(){ $.ajax({ ...
Gautam Sheth's user avatar
4 votes
Accepted

How can I force one to one relationship in SharePoint lists?

I am assuming that you have Employee list(Parent list) and Access card list (Child list) with lookup column "Employee" from parent list. To force one to one relationship, in child list lookup column, ...
P S's user avatar
  • 4,817
4 votes

Column validation for past dates

As far as I know, it's impossible to validate only if particular field changes. It's by default that column validation would validate the data in this column when items are saved to this list. I ...
Michael Han's user avatar
  • 5,211
3 votes
Accepted

Getting List Column Does Not Exist Error When The Column Very Clearly Exists

Go in and check the internal name of the column. You can do this by editing the column and looking at the Field parameter in the url. In my case when I created a column with that name the internal ...
Rothrock's user avatar
  • 3,053
3 votes

Getting List Items in Javascript

Changed var query = SP.CamlQuery() to var query = new SP.CamlQuery() problem solved. Whoops.
ICW's user avatar
  • 434
3 votes

How to get an SPListItem from a Search Query Programmatically

In SharePoint 2013 ListID, ListItemID properties can be added to the result set of KeywordQuery, SearchExecutor: var properties = keywordQuery.SelectProperties; properties.Add("ListID"); properties....
gnagypal's user avatar
3 votes
Accepted

Get multiple list-items by URL with one Rest API request

What @Ekta said: Just get all the items, then in javascript you can parse out the array by id. Let's say you had an array of all the listitem ids named itemidarray such as var itemidarray = [1, 5, ...
Mike's user avatar
  • 12.2k
3 votes
Accepted

SP - Delete list item and folders in Recycle bin with C#

To send items to Recycle bin, you can do like this: //Custom List if (list.BaseType == SPBaseType.GenericList) { SPListItemCollection coll = list.Items; foreach (SPListItem listitem in coll) ...
Cecilia's user avatar
  • 984
3 votes

Get multiple list-items by URL with one Rest API request

There are 2 different approaches to read items from List using REST API If you are reading items from single list with different conditions matches your results then use filter operation as shown in ...
Venkat Konjeti's user avatar
3 votes
Accepted

How to change the list name using c#?

using (var oSite = new SPSite(fundURL)) { using (var oWeb = oSite.OpenWeb()) { var listWithArticles = oWeb.Lists.TryGetList("Articles"); if(listWithArticles != null) ...
Goshky's user avatar
  • 2,058
3 votes

Fetching and displaying more than 5000 list items

The 5000 items threshold, restricts the number of items you can fetch using one query/view. You can read more than 5000 items by fetching the items in batches or provide pagination. Here is another ...
Ram's user avatar
  • 723
3 votes
Accepted

How to properly use GridView to create items on SharePoint Lists?

Try below code private void AddGridRecords(int ID) { try { SPWeb web = SPContext.Current.Web; SPList List = web.Lists["FORM D List"]; web....
P S's user avatar
  • 4,817
3 votes
Accepted

What is the client side equivalent of SPAttachmentCollection.Recycle method

You need to append recycleObject to the attachment endpoint to send them to the recycle bin. The REST endpoint would be as: .../getItemById(20)/AttachmentFiles/getByFileName('test.docx')/...
Gautam Sheth's user avatar
3 votes
Accepted

Folder Name not showing with powershell

The correct field value to use is FileLeafRef for folder names Modify your code as write-host $item["FileLeafRef"] should output the folder name
Gautam Sheth's user avatar
3 votes

SPfx Show More button with a different approach?

While willman's critique of your code is correct (I was going to add all that into my answer as well - you should definitely be saving that data in state, not a class property, and relying on the fact ...
Dylan Cristy's user avatar
  • 12.8k
2 votes

REST to get list item by Id

Official documentation from MS provides all possible examples. https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest This will return an individual ...
AtariPixel's user avatar
2 votes

Converting ListItemCollection to List<t> efficiently

Here is my solution with Linq: configItems.AsEnumerable().Select(x => ToObjectA(x)).ToList();
MmM's user avatar
  • 121
2 votes
Accepted

Pull Data from SharePoint List using JS and converting it into HTML in the following format?

I'm using Sharepoint 2013 in office 365. As using lookup will impact the current structure i have. In SPD 2013, is there any way to do data source merging, i can't find it anywhere. I managed to use ...
san's user avatar
  • 1,654
2 votes
Accepted

SPListItem will accept the column display name OR the column internal name

From MSDN: https://msdn.microsoft.com/library/microsoft.sharepoint.splistitem For an indexer based on a name, Microsoft SharePoint Foundation first looks for the field by internal name and then ...
Juan Pablo Pussacq Laborde's user avatar
2 votes

SP - Delete list item and folders in Recycle bin with C#

For sharepoint list, use below code: if (list.BaseType == SPBaseType.GenericList) { if (list != null) { int itemCount = list.ItemCount; for (int k=0; k<itemCount; k++) ...
Gautam Sheth's user avatar
2 votes
Accepted

SP - How to delete(clear) folders/items from doclib/list

To delete items within document library , try the following foreach (SPListItem item in list.Items) { item.File.Delete(); } } To delete folders with its ...
Mohamed El-Qassas MVP's user avatar
2 votes
Accepted

Help understanding powershell script

There is no definition for get-splist mentioned in the second script. to get the list items from all the lists you have to loop through all the sub sites. For your second question about "|": its is ...
kesava's user avatar
  • 2,176
2 votes
Accepted

List items updated programmatically do not save changes?

Interesting. It had to do with how I was accessing the SPListItem objects. I needed to explicitly get myList.Items[i] as an SPListItem. Once I changed the inner part of the for loop to be // loop ...
Dylan Cristy's user avatar
  • 12.8k
2 votes
Accepted

Modifying a list item field using powershell without changing the following values (modifed/modifiedby/Version)

The SystemUpdate() method is indeed what you are looking for. This method will update the item without changing the Modified, Modified By, and Version fields. Your PowerShell script will do exactly ...
Mihail's user avatar
  • 2,079
2 votes

Available options in SharePoint 2016 on-premise to print list items and have a custom print page with header,footer, etc

SharePoint does not include this capability. You may be able to use JSLink on the list view to do formatting along with other JavaScript and CSS in a Content Editor web part or Script Editor web part ...
mannaggia's user avatar
  • 999
2 votes
Accepted

How to get the "full URL" of a List in SharePoint JSOM

While loading the list object make sure you include the properties to get url. Also List object in JSOM doesn't have method get_url() like Site or Web object have in JSOM. In order to retrieve the ...
ThinkB4Code's user avatar
  • 2,980

Only top scored, non community-wiki answers of a minimum length are eligible