Hot answers tagged

6

Make sure that the column you include in the where clause is defined as an indexed column in SharePoint. You can check by going to the list you're querying and into List -> Settings -> Indexed Columns. It's not applicable in your CAML query, but if you have more than one 'where', ensuring the first where hits an indexed column can increase efficiency. ...


4

Try this (Excerpt from here): function getListItem(url, listname, id, complete, failure) { // Getting our list items $.ajax({ url: url + "/_api/web/lists/getbytitle('" + listname + "')/items(" + id + ")", method: "GET", headers: { "Accept": "application/json; odata=verbose" }, success: function (data) { // ...


4

You can get Distinct values for email column from your SharePoint list using below mentioned code. i had showed how to insert the distinct email values in drop down list. you can change the code accordingly. try { SPList oList = SPContext.Current.Web.Lists["Your List Nmae Here"]; SPQuery query = new SPQuery(); query.Query = "<OrderBy><FieldRef ...


3

You can use SharePoint web services. Below is the snippet I copied from http://stackoverflow.com/questions/22450717/add-and-update-single-item-in-sharepoint-list-via-vba Sub Add_Item(ListName As String, SharepointUrl As String, ValueVar As String, FieldNameVar As String) Dim objXMLHTTP As MSXML2.XMLHTTP Dim strListNameOrGuid As String Dim strBatchXml As ...


3

Explanation Based on your affirmative response to my comment, I've gone ahead and wrote this using the JSOM API. The script works by disabling the ReadOnly property on the RichMessage field, updating the values on your target item, and re-enabling the ReadOnly field. Up until now, this is the only working strategy I've found to change read-only fields from ...


3

Your code looks like Server Object Model. Based on my experience on using CAML queries, I can suggest you to get rid of <Query> tags. So update your query as below Query = "<Where>" + "<Eq>" + "<FieldRef Name='ows_PostID' LookupId='TRUE'/>" + "<Value Type='Lookup'>" + ...


3

You can create a Custom Timer Job which will monitor the items. Just compare the current date and item modified field. For example var lastModified = (DateTime.Now - (DateTime) item["Modified"]).Days; If the duration is greater than or equal to 20 days, then take action. Steps of creating Custom Timer Job for on-premise, find here Create and Deploy Custom ...


3

Find folder name from ServerUrl of your document. It should look like "/{LibraName}/{FolderName}/{fileName.extention}" So the folder is always before the document. Coding Changes cqy.set_viewXml("<View Scope='RecursiveAll'> <ViewFields> <FieldRef Name='ID'/> <FieldRef ...


2

You have to explicity get all fields with var fields= oList.get_fields(); ctx.load(fields) you can then loop over all with var fieldsenum = fields.getEnumerator(); while (fieldsenum.moveNext()) { var field = fieldsenum.get_current(); var fieldname = field.get_internalName(); }


2

For this little requirement you do not need to create any CSOM or workflow. Just use the Alert of SharePoint. It's default feature. See the steps of alert sending here


2

I think what your looking for is this: using rest var value = SP.File.get_checkOutType() https://msdn.microsoft.com/en-us/library/office/jj244900.aspx https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.checkouttype.aspx Example $.ajax({url: "/_api/web/getFileByServerRelativeUrl('" + pageUrl + "')/checkOutType", headers: ...


2

Considering that the only times a "start date" may then change is when an item is inserted or the item preceding it is changed, I would try and see if you goal can just be achieved by using item based event handlers. An item added event could be used to retrieve the end date of the item preceding the one you are adding, and then setting the "start date" of ...


2

I don't know if it is possible with CAML, but this should work: var emails = List.getItems(querysp).OfType<SPListItem>().Select(item => "" + item["email"]).Distinct();


2

I have seen this happen before (when a programmer without SharePoint knowledge 'fixed' a problem with imported/pasted data and emptied/deleted the existing definition of DropDown values The underlying database stores anything that is written to it, so modern JSOM code can write values to a 'DropDown' field without checking those values actually match with ...


2

CAML schema is case-sensitive. You need to change <values> to <Values>. In general all elements are capitalized, but for some reason there are elements like <CHOICES> written in uppercase. When in doubt, best reffer to Collaborative Application Markup Language (CAML) schemas on MSDN.


2

I've edited the complete code, to match your code. And don't forget to set permissions in the Appmanifest.xml. This should work: App.js: 'use strict' var context = SP.ClientContext.get_current(); var listItems; var hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl")); var parentContext = new SP.AppContextSite(clientContext, hostweburl); ...


2

You'll need to look into event handlers for this. You're probably looking for the ItemUpdated event. How to create an event receiver Also MSDN ItemUpdated event


2

Because you do not Change the value in the field, you just Change the value in your variable. you have to item[fieldID] = "";


2

Avoid using SPContext inside receiver. SPContext doesn't exist in a feature receiver. Instead use the Properties object as it includes a reference to the site or web use following public override void FeatureActivated(SPFeatureReceiverProperties properties) { SPWeb web = properties.Feature.Parent as SPWeb; using (SPSite site = new ...


2

Rupesh, You need to use ProcessBatchData for your scenario if you can use server side code. If you want to use only CSOM the below code works just fine. I have tested it already $(document).ready(function() { ExecuteOrDelayUntilScriptLoaded(abc, "sp.js"); }); function abc() { context = new ...


2

As you are hitting the server to frequently to Add items, SharePoint sometimes do stop the execution in between. I faced the similar issue when i was deleting items from the list. Your code is fine, I would suggest you to add a few moments of delay after adding like 50/100 items. Its even better if you can do an asynchronous loop but it will require you to ...


2

The ItemCount function could be applied to List resource, for example: /_api/web/lists/getbytitle('<list title>')/ItemCount but not to ListItemCollection resource You could consider the following options of getting items count for list items: Option 1 How to return items count from json result: var endpointUrl = ...


2

Make sure Nedia you follow all the steps explained here: Link. Or you can refer this example here. I doubt that there might be some problem with the App permission you are assigning for the app. Using CSOM you can do your operation but for that first you need to assign the permission to your app to access those functionalities. Hope this helps!


1

In AppManifest.xml file add Permission for your app. If you are performing CRUD operations on List Or Library then provide necessary Permission based on scope. eg: We are using Manage Permission for developer on Site Collection Scope.


1

Before getting to the cause of your issue, let me give you some recommendations for improving your code, because, as it stands, it is hardly readable. Avoid clattering the global scope with unnecessary variables and functions. Look into the module pattern, it will help you keep your code cleaner. You don't really need to use the Function.CreateDelegate, ...


1

We might have to manipulate/update the data without changing the Modified or Modified By fields to meet the business needs and also retaining the document/Item status without incrementing the version is also important aspect to be considered. In such cases SystemUpdate() method of SPListItem can be leveraged. This basically updates the content database with ...


1

Using CAML query is the best option for retrieving data. As list grows if the result set has more than 5000 items, then performance will degrade. To handle this situation as SCMC suggested you should add indexes to fields used in the WHERE clause. If you still observe performance issues, the I would suggest using Pagination. So get items in set to X items. ...


1

There is an XML type in PowerShell. Exploring XML Document by Using the [XML] Type Accelerator Define $a as [XML]$a = $item["XMLField"]; Now you would be able to lookup set the value of NodeImLookingFor as $a.NodeImLookingFor = "New Value"; Regards


1

What you want to do is use the Feature Upgrade mechanism to add the columns to the already existing list. If you just re-deploy the feature without "upgrading", then yes, the existing list will be overwritten with a new, blank list. Here is some documentation on MSDN about Feature Upgrades. Here is a series of blog posts by Chris O'Brien about Feature ...


1

I don't think so. ItemUpdated is asynchronous, so by the time it fires, a response has already been sent back to the browser. If you do not have access to the HTTP Request and Response, you can't tell the browser to redirect.



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