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;
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 ...
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 ...
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....
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({
...
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, ...
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 ...
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 ...
3
votes
Getting List Items in Javascript
Changed var query = SP.CamlQuery() to var query = new SP.CamlQuery() problem solved. Whoops.
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....
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, ...
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)
...
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 ...
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)
...
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 ...
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....
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')/...
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
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 ...
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 ...
2
votes
Converting ListItemCollection to List<t> efficiently
Here is my solution with Linq:
configItems.AsEnumerable().Select(x => ToObjectA(x)).ToList();
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 ...
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 ...
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++)
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
splistitem × 525list × 95
development × 71
splist × 49
sharepoint-online × 44
2013 × 43
sharepoint-enterprise × 43
2010 × 42
javascript × 41
sharepoint-server × 35
powershell × 34
sharepoint-foundation × 30
event-receivers × 28
workflow × 23
updatelistitems × 23
document-library × 22
client-object-model × 17
sharepoint-designer × 16
splistitemcollection × 16
permissions × 15
custom-list × 15
spfield × 15
2007 × 13
rest × 12
jsom × 12