Tag Info

Hot answers tagged


Lists columns have this functionality built in. Simply enable the enforce unique values option on your desired column. Then you try to add your item like normal in your JavaScript code. Any error you will receive in the callback and you can handle however you'd like at that point. Let the built in SharePoint functionality work for you.


It would look like this (from memory): var camlQuery = new SP.CamlQuery(); var textCAML = "<View><Query><Where><Eq><FieldRef Name='Author' LookupId='TRUE'/><Value Type='Integer'><UserID/></Value></Eq></Where></Query></View>"; camlQuery.set_viewXml(textCAML);


The first Approach deletes every second, because, every time you delete an item from the collection, the item is also removed from the collection. so if the collection before the first delete contained 11 elements, after the deletion there are just 10 elements, and of course, the element on Position i is now the element which was on Position i+1 before ...


You aren't really going to be able to in that fashion with a string sort. You will need to make them 10 - October, 03 - March, 04 - April for them to sort correctly or introduce an ordering column as an alternate way to sort the values. Month----------------Year 03 - March----------------2016 04 - April----------------2016 10 - ...


Check below:How To Validate File Names Of Attachments On SharePoint Forms How could we validate attachment file names and prohibit attachments having invalid names? We can use the same method as described in my former post. We should update our onAttachOKbuttonClicked method with the file name validations. The new version, including the duplicate check as ...


Deleting items one by one can take a hit on performance especially when the number of items increases. SPWeb provide a ProcessBatchData method which can be used for deleting items in bulk. Example code: using (SPSite spSite = new SPSite(site)) { using (SPWeb spWeb = spSite.OpenWeb()) { StringBuilder deletebuilder = ...


That is an incorrect anchor tag. You'd want it to be something like this: itemString += "<a href='" + listItem.get_item('Link').get_url() + "'>"+listItem.get_item('Title') +"</a>";


Yes, you can look though all lists and get list items one by one. var clientContext = SP.ClientContext.get_current(); var web = clientContext.get_web(); var lists = web.get_lists(); clientContext.load(lists); clientContext.executeQueryAsync(function () { var enumerator = lists.getEnumerator(); var listItemsCollection = []; while ...


your original query has invalid xml, it should be <FieldRef Name='Email' /> not <FieldRef Name='Email'>

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