ECMAScript Client Object Model – Get the values from a multi select lookup column field


This post is another continuation of a series of posts related to ECMA Scripting and SharePoint client object model.

ECMAScript Client Object Model – Update a look up field

ECMAScript Client Object Model – Retrieve data from a list

So this time what I’m trying to achieve is to retrieve the values of a list item column. The column is a look up column that brings the data from another list, and the column is a multi select one. So the tricky part is how to iterate through all the lookup values in the specified list item.

Below is the complete ECMAScript for the list item retrieval and then iterating through every item and getting  the lookup values.
Continue reading

ECMAScript Client Object Model – Update a look up field


In a previous post I discussed how to retrieve some values from a SharePoint list and bind it to a drop down list (HTML select). Later I had a requirement update back the selected value of the drop down to another separate list. The values I was retrieving was a lookup field in the second list I wanted to update.

My previous article on retrieve list data : Retrieve Data

So had to spend some time to properly understand how to do the look up field update using client object model.

I added a html button and wrote down a onclick event for the button.

<input type=”button” value=”Submit” onclick=”createListItem();” />

Below is the complete ECMAScript for the new list item update. It contains the two callback functions for successful item creation and failure of item creation. After a successful item creation, the new list item id will be displayed in a alert. Continue reading

ECMAScript Client Object Model – Retrieve data from a list


I’m starting on SharePoint Online development. So was examining what are the capabilities of ECMAScripts and what we can really achieve. So started simply to read some values from a SharePoint list.

In the below example I’m trying to retrieve list data and populate them inside a drop down.

In the markup I have one Dropdown list that will get populated with the list data, and a button to trigger the event for retrieving data and populating the dropdown.

image

I have bound the retrieveListItems method to onclick event of the button.

<select id=”ddlCategory”></select> <br />

<input type=”button” value=”GetData” onclick=”retrieveListItems();” />

Then I have written my ECMA Script in a script block as bellow.

Continue reading

Enable ECMA IntelliSense Sandboxed Visual WebPart…!!!


When working in Visual Studio we really a lot upon intelisense. Recently I started working on some SharePoint Online related work with ECMA Scripts and was finding very difficult to survive without VS intelisense.

There are many blog posts and articles  that illustrate how to enable intellisence in VS for ECMA Scripting. But most of them are not working with Sandboxed solutions and specifically with Sandboxed Visual Web Part (the template comes with SharePoint Power Tools)

So struggling for some time I was able to figure out how to enable it on Sandboxed Visual Web parts.

Steps:

1) Create the Sandboxed Visual Web Part from the VS Item template. Continue reading