Nov 9, 2011

Programming with External Lists In SharePoint Online (Office 365)

In my previous post I announced that SharePoint Online (SPO) in Office 365 now supports Business Connectivity Services (BCS) and shown an example how to connect SPO via BCS to SQL Azure. In this post we’re going to have a look at what you can do programmatically with external lists in SPO. In general we’ve three options: Sanboxed Solutions, Client Object Model and SharePoint Web Services.

Sandboxed Solutions

Especially using the sanboxed object model to program against  external lists in SPO  sounds promising. Just imagine, event receivers and workflow actions that can access external systems through an external list. I was really excited! But the disillusionment followed soon. It seems you can’t connect external systems in SPO via BCS from within sandboxed solutions!
If I try to programmatically access an external list within a sandboxed web part, I get an “The shim execution failed unexpectedly - Access is denied….” exception.
SPList externalList = SPContext.Current.Web.Lists["Customers"];

foreach (SPListItem externalItem in externalList.Items)
{
  writer.Write(externalList.Item["CustomerID"] + ", ");
  writer.Write(externalItem["CompanyName"] + "<br/>");
}

SNAGHTML8ab405
The sandbox stripes out the user’s security token and this means that the credential mapping (e.g. All Users) defined in the Secure Store Service doesn’t work within in the sandbox. The behavior is described in following MSDN article. The suggested work around is that the managed account that runs the user code proxy service (SPUCWorkerProcessProxy.exe) is mapped to the external credentials. But this is not possible in SPO Sad smile

Client Object Model

What indeed does work is using external lists with Client Object Model. There is nice post about this from Steve Fox.
You can use the SharePoint ECMA Client Object Model to access the external customer list from my previous post.
<script type='text/javascript'>
ExecuteOrDelayUntilScriptLoaded(function () {

  var ctx = new SP.ClientContext.get_current();
  var web = ctx.get_web();
  var list = web.get_lists().getByTitle('Customers');
  var query = new SP.CamlQuery();

  query.set_viewXml('<View><ViewFields><FieldRef´Name="CustomerID" /><FieldRef Name="CompanyName" /></ViewFields></View>');
var items = list.getItems(query);

//If you try to use a "default" ClientContext.Load of ListItem data from an external list, 
//you will get the following error: "The given key was not present in the dictionary." Instead, you need to explicitly specify the fields you want in the CamlQuery, 
//and also in the ClientContext.Load method.
  ctx.load(items, 'Include(CustomerID, CompanyName)');

  ctx.executeQueryAsync(
    function (sender, args) {
      var strHtml = "";
      var listItemEnumerator = items.getEnumerator();
      while (listItemEnumerator.moveNext()) {
         var item= listItemEnumerator.get_current();
         strHtml += "<p>" +  item.get_item('CustomerID');
         strHtml += "," + item.get_item('CompanyName') + "</p>";
      }
      $get('output').innerHTML = strHtml;

    }, function (sender, args) { alert(args.get_message()); });

 }, "sp.js");

</script>
<div id='output'></div>

SNAGHTML886a49

Web Services

Another way to program against the external list in SPO is using the SharePoint built-in Lists.asmx web service.

Summary

Although it's nice that SharePoint Online in Office 365 now supports BCS, but as developer I really miss the support for the sandboxed object model. I hope Microsoft will add it with the next service update.

34 comments:

calvintaylor said...

That was a nice overview on sandbox application with a simple example. Even I had a wrong belief that it would be possible, you finally cleared my doubts.

make iphone app said...

Thank you for another opportunity of programming using SharePoint!

Joel Palmer said...

Very helpful!

eSignature said...

I just came across your blog today and absolutely LOVE it! Thank you so much for sharing all of your wonderful ideas!

Cindy Dy said...

I enjoy reading your articles. You really have a wonderful blogs. Keep up the good work. Thank you also for the information!

Caren
www.gofastek.com

Louis Vuitton iPhone 6 Plus Wallet Cases said...

This might be an iPhone “S” year for Apple but iPhone 6s rumors point to some massive changes that could help it compete with a redesigned Galaxy Note 5. The biggest changes could come to the display and camera.

Anonymous said...

can we add list item in external list?

Hug Day said...

happy hug day 2016 SMS
hug day 2016 Wishes cards greetings
Hug day Date 2016
hug day sms

Leslie Lim said...


I simply want to say I am new to weblog and truly savored you’re website. More than likely I’m want to bookmark your blog . You actually have excellent writings. Thanks a bunch for sharing your web site.

Jorcel
www.imarksweb.org

quotes for Veterans Day said...

great artical
thanks
Ramadan EID Mubarak Images
Quotes For Happy New Year 2017
Box Office Prediction of Mohenjo Daro
Fathers Day Wishes
Happy Mothers Day Wishes
Dangal Movie Collection
Diwali Greetings in Hindi
Happy Merry Christmas 2016
Clash of Clans Apk
Advance wishes for Happy New Year 2017
Sultan movie collection
US Open Tennis Match Schedule
Sultan movie collection
Places To Visit in Shimla Manali
SSC Online Result
Mothers Day Wishes
Fathers Day Wishes
SSC Result
CBSE XII Result 2016
CBSE XII Result 2016
Raees movie collection
Happy Diwali Messages
Shivaay Total Collection
Shivaay Total Collection
Funny Cards for Mothers's Day
Mohenjo Daro Movie Income
thanks

Packers Movers said...

movers and packers Ahmedabad to Lucknow charges
movers and packers surat to chandigarh charges
movers and packers rajkot to Lucknow charges
movers and packers Rajkot to chandigarh charges
movers and packers Lucknow to Amritsar charges
movers and packers chandigarh to rajkot charges
movers and packers Amritsar to surat charges
movers and packers Ludhiana to Ahmedabad charges
movers and packers panchkula to Ludhiana charges
movers and packers mohali to varanasi charges
movers and packers Jalandhar to agra charges
movers and packers varanasi to Jalandhar charges
movers and packers allahabad to varanasi charges
movers and packers Kanpur to Bangalore charges
movers and packers agra to Bangalore charges
packers and movers in Bangalore to agra charges
packers and movers chandigarh charges
packers and movers lucknow charges
packers and movers Vadodara charges
packers and movers Ahmedabad charges
packers and movers surat charges
packers and movers Rajkot charges

Packers Movers said...

movers and packers Kolkata to delhi charges
movers and packers delhi to Mumbai charges
movers and packers Mumbai to Nagpur charges
movers and packers pune to Faridabad charges
movers and packers Faridabad to agar charges
movers and packers indore to agar charges
movers and packers chandigarh to trichy charges
movers and packers Chennai to Bangalore charges
movers and packers Bangalore to Chennai charges
packers and movers lucknow to Noida charges
movers and packers Noida to lucknow charges
movers and packers Ghaziabad to chandigarh charges
movers and packers Gurgaon to Ghaziabad charges
movers and packers movers thane to Allahabad charges
movers and packers navi Mumbai to Hyderabad charges
movers and packers Hyderabad to Bhubaneswar charges
movers and packers Bhubaneswar to lucknow charges
movers and packers Raipur to Bhubaneswar charges
movers and packers patna to Raipur charges

Packers Movers said...

car transport from chandigarh to nagpur cost
car transport from lucknow to nagpur cost
car transport from Kolkata to nagpur cost
car transport from Hyderabad to nagpur cost
car transport from Bangalore to nagpur cost
car transport from pune to nagpur
car transport from Mumbai to nagpur cost
car transport from Chennai to nagpur cost
car transport from delhi to nagpur
car transport from Gurgaon to nagpur cost
car transport from Noida to nagpur
car transport from Faridabad to nagpur cost
car transport from Ahmedabad to nagpur cost
car transport from navi Mumbai to nagpur cost
car transport from thane to nagpur cost
car transport from jammu to nagpur cost
car transport from surat to nagpur
car transport from Vadodara to nagpur cost
car transport from Nellore to nagpur cost
car transport from panchkula to nagpur cost
car transport from amritsar to nagpur cost
car transport from Bhavnagar to nagpur cost
car transport from rajkot to nagpur cost
car transport from mohali to nagpur cost
car transport from nagpur to nashik
car transport from nashik to nagpur cost
car transport from Kalyan dombivali to nagpur cost
car transport from vasai virar to nagpur cost
car transport from Bhopal to nagpur cost

Packers Movers said...

car transport from indore to nagpur cost
car transport from kanpur to nagpur cost
car transport from varanasi to nagpur cost
car transport from allahabad to nagpur cost
car transport from Coimbatore to nagpur cost
car transport from Trivandrum to nagpur cost
car transport from cochin to nagpur cost
car transport from mysore to nagpur cost
car transport from kochi to nagpur cost
car transport from visakhapatnam to nagpur cost
car transport from vijayawada to nagpur cost
car transport from trichy to nagpur cost
car transport from goa to nagpur cost
car transport from jaipur to nagpur cost
car transport from patna to nagpur cost
car transport from ranchi to nagpur cost
car transport from raipur to nagpur cost
car transport from guwahati to nagpur cost
car transport from jalandhar to nagpur cost
car transport from jamshedpur to nagpur cost
car transport from dehradun to nagpur cost
car transport from jamnagar to nagpur cost
car transport from gandhinagar to nagpur cost
car transport from ludhiana to nagpur cost
car transport from shimla to nagpur cost
car transport from bhubaneswar to nagpur cost

风骚达哥 said...

20160423 junda
air jordans
cheap oakley sunglasses
kate spade outlet
adidas stan smith
ray ban sunglasses
michael kors outlet
nike air max shoes
cheap omega watches
yeezy boost 350
michael kors outlet online
michael kors outlet online
nike free runs
air jordan uk
michael kors outlet online
pandora charms
ray ban outlet
calvin klein outlet
fitflops sale clearance
toms outlet
nike huarache white
sac longchamp
toms outlet
michael kors outlet clearance
bottega veneta outlet
armani watches
gucci handbags
nike blazer
oakley sunglasses
true religion jeans
cheap jordans
ray bans
hollister
bottega veneta handbags
jimmy choo outlet
oakley sunglasses
converse
prada outlet
reebok shoes
true religion
burberry outlet

Desty Lilian Rosana Putry said...

model meja belajar anak minimalis
warna cat rumah minimalis
model rak tv
model meja makan
taman kolam air
model pintu kamar mandi
model tangga rumah minimalis
warna cat pagar
desain tiang dan keramik teras
kursi sofa ruang tamu minimalis
model tempat tidur bayi
warna cat dapur
model atap rumah minimalis
model plafon minimalis
warna gorden ruang tamu
warna cat rumah tipe 45
model rumah idaman type 36

Libin Huang said...

20160426libinhollister clothing store
oakley sunglasses
michael kors handbags
tiffany outlet
ray-ban sunglasses
gucci outlet online
ray-ban sunglasses
burberry outlet online
coach outlet canada
ray-ban sunglasses
herve leger outlet
ray ban sunglasses sale
air max 90
oakley sunglasses
adidas wings shoes
michael kors outlet
michael kors factory outlet
louis vuitton bags
michael kors online outlet
nba jerseys
ralph lauren pas cher
oakley sunglasses
toms shoes
nike air max 90
nike tn pas cher
air max 90
lululemon outlet
nike air force 1
true religion outlet
michael kors outlet
burberry outlet store
ray ban sunglasses
kobe shoes
true religion outlet
discount michael kors handbags

Blog Admin said...

UP Board 12th Results
UP Board 12th Results 2016
TS Inter 1st Year Supply Results 2016
TS Inter 2nd Year Supply Results 2016
AP Inter 1st Year Supply Results 2016
AP Inter 1st Year Supply Results 2016

UP Board 10th Class Results
UP Class 10th Results2016

Bihar Board Intermediate Results
Bihar Board 10th Results

Ts Eamcet Results 2016
Ts 10th Class Results 2016
Telangana ssc Results 2016
Ts ssc Results 2016
Ap ssc Results 2016
Ts Eamcet Results 2016
Ap Eamcet Results 2016
Download AP Eamcet Exam Key 2016
Download Ts Eamcet Exam Key 2016

Anonymous said...

HD Videos

HD Video Songs

Mp3 Songs

Blog Admin said...

Happy Fathers Day 2016
Happy Fathers Day Messages in hindi 2016
Happy Fathers Day sms in hindi 2016
Happy Fathers Day 2016 Images
Happy Fathers Day Wallpapers 2016
Fathers Day Images 2016
Fathers Day 2016 Wallpapers
Happy Fathers Day Greeting 2016
Happy Fathers Day Wishes 2016
Happy Fathers Day Quotes 2016
Happy Fathers Day SMS 2016
Happy Fathers Day Messages 2016
AP Inter 1st year Supply Results 2016
AP Inter 2nd Year Supply Results 2016

suresh said...

NEET phase-2 RESULT 2016
NEET Answer key download 2016
NEET Admit Card download 2016

suresh said...

Awesome news... really great content
JEE Main 2016 rank

Yuanyuan Lin said...

7.14llllllyuan"hollister shirts"
"true religion canada"
"true religion outlet"
"beats by dre"
"nike tn pas cher"
"ray ban sunglasses"
"tory burch outlet"
"mulberry handbags"
"prada outlet"
"michael kors outlet"
"tiffany outlet"
"louis vuitton neverfull"
"louis vuitton handbags"
"giuseppe zanotti shoes"
"nike uk store"
"michael kors wholesale"
"tiffany jewelry"
"michael kors outlet"
"ralph lauren pas cher"
"mulberry bags"
"nike air force 1"
"police sunglasses for men"
"gucci outlet online"
"ray ban sunglasses"
"jordan shoes"
"asics,asics israel,asics shoes,asics running shoes,asics israel,asics gel,asics running,asics gel nimbus,asics gel kayano"
"cheap jordan shoes"
"basketball shoes"
"fitflops sale"
"prada outlet online"
"ralph lauren polo"
"nike air max 90"
"omega outlet"
"lacoste shirts"
"longchamp outlet"
7.14

Fangyaya said...

polo ralph lauren outlet
mont blanc pen
coach factory outlet online
coach factory outlet
tory burch sandals
michael kors handbags
toms wedges
coach outlet store online clearances
rolex watches outlet
louis vuitton handbags
oakley outlet
giuseppe zanotti outlet
michael kors outlet online
louis vuitton handbags
hermes outlet
louis vuitton outlet
cheap air jordans
michael kors outlet online
louis vuitton outlet stores
toms wedges
ray bans
asics running shoes
celine outlet
michael kors handbags
louis vuitton outlet
tiffany rings
adidas stan smith
michael kors outlet
michael kors outlet
supra shoes
coach outlet
oakley sunglasses wholesale
gucci handbags
louis vuitton purses
kate spade
christian louboutin pas cher
nike outlet
air jordan shoes
rolex watches
true religion outlet online
20168.8chenjinyan

Paulo said...

Most government credits and private banks will permit a six month effortlessness period before you enter into reimbursement, in any case. This is to permit you enough time to get job utilizing your new instruction. payday loans

priya Sharma said...

Here you can get all the details of AP SSC result 2017 and also check out UP Board 12th Result 2017

bhagyashri said...

The Haryana 12th 2017 will be declared on the month of May 2017 At 10 AM Haryana 12th Result 2017 Check Haryana 12th Exam Result 2017 Haryana 12th Result 2017 form here given link
The Bihar board 10 result 2017 will be declared on the month of May 2017. Bihar board 10 result 2017 Check Bihar board 10 Exam result 2017 Bihar board 10 result 2017 form here given link

hello iletsfly said...

There are going to declared out CBSE 12th Result 2017 in the month of May, 2017. Download CBSE 12th Result 2017 once releases out.

Here we get good details, you can get Kerala HSE Result 2017 details, when the Kerala HSE Result 2017 will be released.

Riya Jain said...

Nice details Check Rajasthan Board 12th Result 2017 from here after announcement.

12thresult said...

Bihar Board 12th Result 2017 is going to be
declared in the month of May. for seeing the result directly, you can go for our trusted website to see the 12th board result 2017 .

Board Exams Result said...

Maharashtra SSC Result 2017 standing in the queue of final preparation. Check out Maharashtra 12th Result 2017 from here.

Pk Sharma said...

Check Punjab 12th Result 2017 And Also check Punjab 10th Result 2017and ask your brother to check CTET Application Form 2017 then go out and Download BHIM APP

diksha joshi said...

MDSU BSc 3rd Result
MDSU BSc 2nd Year Result
MDSU BSc 1st Result
MDSU BA 3rd Year Result
MDSU BA 2nd Year Result
MDSU BA 1st Result

Sonam Gupta said...


Maharashtra HSC Result 2017
MBOSE SSLC Result 2017
Meghalaya HSSLC Result 2017
HSC Result 2017
SSC Result