We value your privacy

We use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking "Accept All", you consent to our use of cookies.

CustomiseReject AllAccept All

Powered by Visit CookieYes website

Customise Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorised as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more

NecessaryAlways Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

  • Cookie

__cf_bm

  • Duration

1 hour

  • Description

This cookie, set by Cloudflare, is used to support Cloudflare Bot Management.

  • Cookie

li_gc

  • Duration

6 months

  • Description

Linkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.

  • Cookie

VISITOR_PRIVACY_METADATA

  • Duration

6 months

  • Description

YouTube sets this cookie to store the user's cookie consent state for the current domain.

  • Cookie

cookieyes-*

  • Duration

1 year

  • Description

CookieYes sets this cookie for consent solution management.

Functional

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

  • Cookie

lidc

  • Duration

1 day

  • Description

LinkedIn sets the lidc cookie to facilitate data center selection.

  • Cookie

__Secure-ROLLOUT_TOKEN

  • Duration

6 months

  • Description

YouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.

  • Cookie

__Secure-YEC

  • Duration

past

  • Description

Description is currently not available.

  • Cookie

__Secure-YNID

  • Duration

6 months

  • Description

YouTube cookie used to protect user security and prevent fraud, especially during the login process.

  • Cookie

VISITOR_INFO1_LIVE

  • Duration

6 months

  • Description

A cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.

  • Cookie

ytidb::LAST_RESULT_ENTRY_KEY

  • Duration

Never Expires

  • Description

The cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.

Analytics

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

  • Cookie

_seg_uid_17592

  • Duration

1 year

  • Description

Kit (formerly ConvertKit) uses SegMetrics that sets this cookie as a way to identify when users click links in our emails. No PII is collected by this cookie.

  • Cookie

_seg_uid

  • Duration

1 year

  • Description

Kit (formerly ConvertKit) uses SegMetrics that sets this cookie as a way to identify when users click links in our emails. No PII is collected by this cookie.

  • Cookie

_seg_visitor_17592

  • Duration

1 year

  • Description

Kit (formerly ConvertKit) uses SegMetrics that sets this cookie as a way to identify when users click links in our emails. No PII is collected by this cookie.

  • Cookie

ai_sessionvoitanos

  • Duration

1 hour

  • Description

Microsoft Azure sets this cookie as a unique session identifier cookie, enabling counting of the number of users accessing the application over time.

  • Cookie

ai_user

  • Duration

1 year

  • Description

Microsoft Azure sets this cookie as a unique user identifier cookie, enabling counting of the number of users accessing the application over time.

  • Cookie

_ga_*

  • Duration

1 year 1 month 4 days

  • Description

Google Analytics sets this cookie to store and count page views.

  • Cookie

_ga

  • Duration

1 year 1 month 4 days

  • Description

Google Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.

  • Cookie

_clck

  • Duration

1 year

  • Description

Microsoft Clarity sets this cookie to retain the browser's Clarity User ID and settings exclusive to that website. This guarantees that actions taken during subsequent visits to the same website will be linked to the same user ID.

  • Cookie

_clsk

  • Duration

1 day

  • Description

Microsoft Clarity sets this cookie to store and consolidate a user's pageviews into a single session recording.

  • Cookie

seg_domain_test

  • Duration

session

  • Description

Kit (formerly ConvertKit) uses SegMetrics that sets this cookie as a way to identify when users click links in our emails. No PII is collected by this cookie.

  • Cookie

YSC

  • Duration

session

  • Description

YSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.

Performance

Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement

Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.

  • Cookie

bcookie

  • Duration

1 year

  • Description

LinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.

  • Cookie

_gcl_au

  • Duration

3 months

  • Description

Google Tag Manager sets this cookie to experiment advertisement efficiency of websites using their services.

  • Cookie

_fbp

  • Duration

3 months

  • Description

Facebook sets this cookie to store and track interactions.

  • Cookie

ckid

  • Duration

Never Expires

  • Description

Adara yield sets this cookie to deliver advertisements tailored to user interests on other websites and track transactions

  • Cookie

test_cookie

  • Duration

15 minutes

  • Description

doubleclick.net sets this cookie to determine if the user's browser supports cookies.

Uncategorised

Other uncategorised cookies are those that are being analysed and have not been classified into a category as yet.

  • Cookie

_rm_ctx

  • Duration

1 year

  • Description

Description is currently not available.

Reject AllSave My PreferencesAccept All

Powered by Visit CookieYes website

Voitanos is Closing October 1, 2026

Read the announcement, how it impacts customers, and 50% off everything!

Read The Announcement

articles

Getting BreezeJS to Work with the SharePoint 2013 REST API

[Development](/content/tags/development/ "View all posts tagged with 'Development'"/index.html) [Microsoft 365](/content/tags/microsoft-365/ "View all posts tagged with 'Microsoft 365'"/index.html) [SharePoint](/content/tags/sharepoint/ "View all posts tagged with 'SharePoint'"/index.html) [SharePoint 2013](/content/tags/sharepoint-2013/ "View all posts tagged with 'SharePoint 2013'"/index.html) [SharePoint 2016](/content/tags/sharepoint-2016/ "View all posts tagged with 'SharePoint 2016'"/index.html) [SharePoint 2019](/content/tags/sharepoint-2019/ "View all posts tagged with 'SharePoint 2019'"/index.html) [SharePoint SE](/content/tags/sharepoint-se/ "View all posts tagged with 'SharePoint SE'"/index.html)

by Andrew Connell

Last updated March 4, 2014

9 minutes read

Share this

Focus Mode

  • Acquire the Breeze Library
  • Acquire the Breeze SharePoint Data Service
  • Configure Breeze to work with SharePoint
  • Define your Entity Metadata Model
  • Using Breeze with SharePoint 2013’s REST API
  • Feedback & Comments

This post is part of a series I’ve written on using the popular Breeze JavaScript library with the SharePoint REST API. The other posts in this series can be found here: Simplify SharePoint (2013-present) REST queries BreezeJS

There’s a good amount of code snippets in this post. Typically code formatting doesn’t render great in RSS readers so check out the post on my blog for a well formatted version.

So far in this series of posts I’ve introduced you to the Breeze library (part 1) and some challenges we have in using it OOTB (part 2). In this post I want to explain how you can use it. This breaks down into a few different tasks:

  • Acquire the Breeze Library
  • Acquire the Breeze SharePoint Data Service
  • Configure Breeze to work with SharePoint
  • Define your Entity Metadata Model
  • Use It!

As I walk through each of these steps, I’m trying to keep this as simple as possible. I’m doing everything in one file to make exploring the code as easy as possible, but in the real world I never do this. I prefer many JavaScript files and let each one serve a specific purpose, making the code more maintainable. But here I’ve done it all in one file. You can download the sample app I used to create this post from this public GitHub project I created: BreezeSP2013Sample. Just grab the code, open it in Visual Studio 2012/2013, change the Site URL property for the project to point to your SharePoint developer site (on-prem or Office 365) and hit F5 to see how it works!

Let’s dive in so you can see what’s involved…

Acquire the Breeze Library [Deep link anchor for 'Acquire the Breeze Library'](/content/blog/getting-breezejs-to-work-with-the-sharepoint-2013-rest-api/#acquire-the-breeze-library "Deep link anchor for 'Acquire the Breeze Library'"/index.html)

You first need to get the Breeze client-side library. This is provided as a NuGet package: Breeze.Client. For this you need the latest version (v1.4.9) which came out in late February 2014. This is by far the easiest step because you can skip it! You’ll see why in a moment…

Acquire the Breeze SharePoint Data Service [Deep link anchor for 'Acquire the Breeze SharePoint Data Service'](/content/blog/getting-breezejs-to-work-with-the-sharepoint-2013-rest-api/#acquire-the-breeze-sharepoint-data-service "Deep link anchor for 'Acquire the Breeze SharePoint Data Service'"/index.html)

Next, you need to get the Breeze SharePoint Data Service adapter. This is what Ward Bell, one of the brains behind Breeze, and I have been working on. It’s in a easy to grab NuGet package: Breeze.DataService.SharePoint. Best part is it already includes the Breeze client library package which is why you could ignore the previous step. It also includes a few other dependencies.

Once you’ve done this, add the necessary references to your HTML page, as shown here:

<script type="text/javascript" src="../Scripts/q.js"></script>
<script type="text/javascript" src="../Scripts/breeze.debug.js"></script>
<script type="text/javascript" src="../Scripts/breeze.labs.dataservice.abstractrest.js"></script>
<script type="text/javascript" src="../Scripts/breeze.labs.dataservice.sharepoint.js"></script>
<script type="text/javascript" src="../Scripts/breeze.metadata-helper.js"></script>

… just the HTML page with references

Configure Breeze to work with SharePoint [Deep link anchor for 'Configure Breeze to work with SharePoint'](/content/blog/getting-breezejs-to-work-with-the-sharepoint-2013-rest-api/#configure-breeze-to-work-with-sharepoint "Deep link anchor for 'Configure Breeze to work with SharePoint'"/index.html)

After you get everything, you then need to configure Breeze. This involves first initializing Breeze to use the new SharePoint data service adapter using the breeze.config.initializeAdapterInstance() function:

// configure breeze to use SharePoint OData service
var dsAdapter = breeze.config.initializeAdapterInstance('dataService', 'SharePointOData', true);

Then you need to tell Breeze how to get the security validation token, also known as the form digest, security digest, or the request digest. This is needed when you want to do an HTTP POST or DELETE against the SharePoint REST API. For this I’ll simply use the hidden form field added to the page:

// tell breeze how to get the security validation token for
//  HTTP POST & DELETE calls
dsAdapter.getRequestDigest = function () {
  return jQuery('#__REQUESTDIGEST').val();
};

OK… everything is all configured. Next up, tell Breeze about our entities.

Define your Entity Metadata Model [Deep link anchor for 'Define your Entity Metadata Model'](/content/blog/getting-breezejs-to-work-with-the-sharepoint-2013-rest-api/#define-your-entity-metadata-model "Deep link anchor for 'Define your Entity Metadata Model'"/index.html)

In this step you will build the metadata that tells Breeze about the list we want to work with. In my sample app I created a simple Contacts list in the app and to keep things simple, I only want to deal with the first and last names as well as the email address.

Writing the metadata can involve a good amount of code as you would expect. However over in the Breeze Labs there is a slick helper utility library called the Breeze Metadata Helper that helps quite a bit. I’ll add this via an easy to use NuGet package: Breeze.Metadata.Helper.

Then I’ll get a reference to the metadata helper and create an alias named addType() that will add the new entity type to the metadata store for me as well as set up a default select statement so I don’t have to deal with that in my code:

// create a new breeze metadata store
metadataStore = new breeze.MetadataStore();

// set up a helper to create entities
var namespace = '';
var helper = new breeze.config.MetadataHelper(
                    namespace,
                    breeze.AutoGeneratedKeyType.Identity);
// define a new function that uses the helper to
//  1) create a new entity type in the metadata store
//  2) create a default select so we don't have to create the
//    OData $select each time
var addType = function (typeDef) {
  var entityType = helper.addTypeToStore(metadataStore, typeDef);
  _addDefaultSelect(entityType);
  return entityType;
};

// add 'defaultSelect' custom metadata that selects for all
//  mapped data properties could be used by SharePoint dataservice
//  adapter to exclude unwanted property data in query payload
function _addDefaultSelect(type) {
  var custom = type.custom;
  // bail out if defined by hand already
  if (custom && custom.defaultSelect != null) { return; }

var select = [];
  type.dataProperties.forEach(function (prop) {
    if (!prop.isUnmapped) { select.push(prop.name); }
  });
  if (select.length) {
    if (!custom) { type.custom = custom = {}; }
    custom.defaultSelect = select.join(',');
  }
  return type;
}

Last but not least, I’m going to create an entity that maps to the contact list… take notice that I am not getting all fields from the contact list, just the ones I’m interested in. Oh, check out the email property… Breeze won’t let me save it unless it passes Breeze’s RegEx email address validation!:

// create entity for contacts
addType({
  name: 'Contact',
  defaultResourceName: 'getbytitle(\'Contacts\')/items',
  dataProperties: {
    Id: { type: breeze.DataType.Int32 },
    FirstName: { nullable: false },
    Title: { nullable: false },
    Email: {
      nullable: false,
      validators: [breeze.Validator.emailAddress()]
    }
  }
});

There are a few properties to take note of:

  • name: this is the name that we’ll use to reference our entity if we need to throughout our app
  • defaultResourceName: this is the endpoint for the list… not everything is listed here in the URL because as you’ll see, we’ll define the base part to the REST endpoint for the site in a moment
  • dataProperties: collection of the fields we want to get from SharePoint; notice some of these also include validation statements to enforce some data integrity

So with that, Breeze has been added to the page, configured and the metadata has been defined. Let’s now use it!

For more information on working with Breeze and SharePoint, check out my upcoming new Pluralsight course, coming soon in March 2014 now available: Building SharePoint Apps as Single Page Apps with AngularJS. Module 5 is all about using Breeze with SharePoint.

Using Breeze with SharePoint 2013’s REST API [Deep link anchor for 'Using Breeze with SharePoint 2013’s REST API'](/content/blog/getting-breezejs-to-work-with-the-sharepoint-2013-rest-api/#using-breeze-with-sharepoint-2013s-rest-api "Deep link anchor for 'Using Breeze with SharePoint 2013’s REST API'"/index.html)

Before we start making calls, let’s first get an instance of something called the EntityManager. This is what will make the calls to the server for us. Part of this is also defining the data service, telling the SharePoint data service adapter to not request metadata from SharePoint’s REST API and what the root URL is in the REST API:

// init breeze for queries
function initBreeze() {
  // get reference to contact entity type
  contactType = metadataStore.getEntityType('Contact');

// create the data service
  var dataService = new breeze.DataService({
    // tell breeze the root REST endpoint to use
    //  since we only are using lists, point to that
    serviceName: _spPageContextInfo.webAbsoluteUrl + '/_api/web/lists/',
    // tell breeze not to interrogate sharepoint for it's
    //  massive OData $metadata response... we created it manually
    hasServerMetadata: false
  });

// create an instance of the entity manager
  entityManager = new breeze.EntityManager({
    dataService: dataService,
    // tell breeze where the metadata is
    metadataStore: metadataStore
  });
}

Now let’s see how to get data… for this I’ll fetch all the results from the contact list, using Breeze:

breeze.EntityQuery
  .from(contactType.defaultResourceName)
  .using(entityManager)
  .execute()
  .then(function (response) {
    var results = response.results;
    // write results > div
    if (results && results.length) {
      var message = '';
      for (var index = 0; index < results.length; index++) {
        message += results[index].FirstName
          + ' ' + results[index].Title
          + ' (' + results[index].Email + ')<br />';
      }
      jQuery("#results").html(message);
    }
  });

And if we wanted to get only one item, here’s how you do a filter:

breeze.EntityQuery
  .from(contactType.defaultResourceName)
  .using(entityManager)
  .execute()
  .where('Id', 'eq', 1)
  .then(function (data) {
    var message = data.entity.FirstName
        + ' ' + data.entity.Title
        + ' (' + data.entity.Email + ')<br />';
    jQuery("#results").html(message);
  });

What about updating items? Well all you do is get the item, make some changes and just call save!

// get the first item
var promise = breeze.EntityQuery
  .from(contactType.defaultResourceName)
  .using(entityManager)
  .execute()
  .where('Id', 'eq', 1)
  .then(function (data) {
    return data.entity;
  });

// update the first item
promise.then(function (contact) {
  contact.Title = 'NewName';
  entityManager.saveChanges().then(function () {
    jQuery("#results").html('saved first item in list');
  });
});

And deleting an item? This is similar to an update item:

// deletes the last item in the list
function deleteItem() {
  // delete the last item in the list
  breeze.EntityQuery
    .from(contactType.defaultResourceName)
    .using(entityManager)
    .execute()
    .then(function (response) {
      var results = response.results;
      var lastContact = results[results.length - 1];
      lastContact.entityAspect.setDeleted();
      entityManager.saveChanges()
        .then(function () {
          jQuery("#results").html('last item in list deleted');
        });
    });
}

And a very cool piece to this. Once you get items back from SharePoint which are stored in the Breeze local cache, you can re-fetch them at a later time without going to the server. The following call is effectively telling Breeze “get a contact with ID=1 from cache, but if you don’t find it, then go to the server to find it:”

// try to get a single item from the cache, then revert to server
entityManager.fetchEntityByKey('Contact', 1, true)
  .then(function (data) {
    var message = data.entity.FirstName
        + ' ' + data.entity.Title
        + ' (' + data.entity.Email + ')<br />';
    message += 'pulled from: ' + (data.fromCache ? 'cache' : 'server');
    jQuery("#results").html(message);
  });

Pretty slick huh? Again, remember what I said at the beginning of the post. I know you think “that was a lot of work at the start to configure and set it up.” I would agree with that to a point, but most of it is boilerplate code… everything except the creation of the metadata would be the same from one project to another.

Again… you can download the sample app I used to create this post from this public GitHub project I created: BreezeSP2013Sample. Just grab the code, open it in Visual Studio 2012/2013, change the Site URL property for the project to point to your SharePoint developer site (on-prem or Office 365) and hit F5 to see how it works! Hopefully you’ll find this as cool as I do… I can’t imagine working with SharePoint’s REST API without Breeze ever again! It just makes working with SharePoint’s REST API… well… a Breeze!

author

Andrew Connell

Microsoft MVP, Full-Stack Developer & Chief Course Artisan - Voitanos LLC.

Andrew Connell is a full stack developer who focuses on Microsoft Azure & Microsoft 365. He’s a 22-year recipient of Microsoft’s MVP award and has helped thousands of developers through the various courses he’s authored & taught. Whether it’s an introduction to the entire ecosystem, or a deep dive into a specific software, his resources, tools, and support help web developers become experts in the Microsoft 365 ecosystem, so they can become irreplaceable in their organization.

[Andrew Connell](/content/pages/about-andrew/ "Andrew Connell"/index.html)Andrew ConnellAndrew Connell on youtubeAndrew Connell on linkedinAndrew Connell on blueskyAndrew Connell on redditAndrew Connell on mvp

Feedback & Questions [Deep link anchor for 'Comments & Questions'](/content/blog/getting-breezejs-to-work-with-the-sharepoint-2013-rest-api/#feedback "Deep link anchor for 'Comments & Questions'"/index.html)

giscus

0 reactions

19 comments

·

40 replies

– powered by giscus

  • Oldest
  • Newest

WritePreview

Styling with Markdown is supported

Sign in with GitHub

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by russell gove on 2014-03-06 17:58

Do yo think the adapter will work on 2010?

0

1 reply

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2014-03-06 22:54

We never tested it against SharePoint 2010, but I don't believe it would work. It uses the OData v3 spec which is not what the 2010 REST API & listdata.svc service.

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by Todd Boewe on 2014-03-07 21:06

I am excited to try this after SPC2014. I am attempting to get the sample working with IE8. I have added es-5-shim and es-5-sham but I can't get past entity creation. The sham fails with a TypeError of ERR_ACCESSORS_NOT_SUPPORTED. Any ideas for getting past this? Thank you!

0

3 replies

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2014-03-09 05:31

Unfortunately BreezeJS doesn't work with IE8 all that well... check their prereq's ( http://www.breezejs.com/doc...). FWIW BreezeJS (and AngularJS for that matter) will be dropping support for IE9 and lower soon.

vtns-comment-importer Jan 9, 2024

Originally posted by Ward Bell on 2014-03-13 03:41

To be a bit more precise, the combination of Breeze plus Angular doesn't work for IE8 (or older pre-ECMAScript 5 browsers). You can use Breeze plus Knockout if you need to support IE8 (and if you use Knockout, check out Durandal which provides a rich app development environment on top of Knockout). You will still need those shims but you won't have to worry about the (unshimmable) ES5 JavaScript property accessors.

vtns-comment-importer Jan 9, 2024

Originally posted by Bruce Albany on 2014-07-19 20:47

Thanks for this - the Angular + Breeze dead end for IE8 is a big gotcha for all my current SP2013 angular projects. Guess I'll be holding off on using breeze for now...

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by Martin Ganser on 2014-03-17 03:03

Nice sample. Everyrhing works as expected.

I tried to get list data from the host web of my app, but there seems to be a 'Cross Domain' issue.

Is that a 'breeze'- thing or am I missing something?

0

1 reply

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2014-03-19 13:04

You aren't missing anything. We haven't done any work around the cross domain stuff with breeze. We simply wanted to get it working at this point... cross domain is something we'll look into as this progresses.

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by JIBI BABU on 2014-04-01 05:03

How to use lookup fields. I have a people/group coloumn which I need to include in my entity.

0

2 replies

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2014-04-01 11:06

People columns are just lookup columns pointing back to the UserInfo list in a site, as such you use them like that. Check this post out for working with a people column: http://www.andrewconnell.co...

You should be able to leverage the same relationship joins the way Breeze supports joins.

vtns-comment-importer Jan 9, 2024

Originally posted by JIBI BABU on 2014-04-04 01:24

Thanks . I am creating a Sharepoint Helpdesk App for the organization. The breeze definitely helps.

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by WisdomGuidedByExperience on 2014-06-16 21:32

What about $expand? Does BreezeJS make that easy/easier to use? For example, doing things "the long, hard way" involves the following for me to get the ContentType.Name property of an SPListItem in my KnockoutJS view model (code snippet only) when building up a GET OData call:

self.select = '$select=*,Order,ContentType/Name&$expand=ContentType';

This allows me to reference spItem.ContentType.Name later on in my code.

What, if anything, does BreezeJS buy me in terms of simplicity, maintainability and/or code clarity in terms of the above requirement?

0

1 reply

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2014-06-18 02:00

Breeze can do relationships... works great. I actually show how to do this in my course ( http://www.pluralsight.com/...), specifically the module on Breeze. There are some variations depending on your current patch level with SharePoint 2013 as there were some issues in the API early on.

Specifically to content types, you'll need to create another entity and map it's navigation property to the entity of the item in question so Breeze knows about it. Then it's just another reference just like you have in normal one-many joins in a LINQ query.

I'm working on some more blog posts about using SharePoint & Breeze together so stay tuned as this is a scenario I plan to cover!

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by Alexandre Menezes on 2014-07-28 13:32

Hi there! Thanks for the example. I am trying to use Breeze with Angularjs on a SP2013 App. Right now I am having problems when trying to get one item using the ".where()" when using the EntityQuery. The error that I am getting from VS2013 is "Object doesn't support property or method 'where'". Any tips would be great. :)

0

0 replies

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by John Palmer on 2014-10-17 14:25

Andrew, what about .take and .skip? It seems the SharePoint 2013 REST API's dirty little secret is that it doesn't do paging. Even if I request the REST/OData calls outside of Breeze, $skip does not work. Do you have or know of a solution? Thanks!

0

3 replies

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2014-10-23 16:51

Unfortunately there are a few things that the SharePoint REST API does not fully implement from the OData v3.0 spec. There's lots of stuff in MSDN talk mentions OData, but it really shouldn't as it isn't a fully valid service. No tool will change that... even Breeze. Breeze is using the SharePoint REST API so there's no magic they can use to make paging work.

With that being said, the public Office 365 Roadmap states they are working on OData v4.0 support... which, hopefully, is a full implementation of the spec that includes not only all the operators but also $batch.

I've got a project in GitHub that's all ready to test batching as soon as it's ready... the service just needs to support it. :) I'm hopeful we'll get some update on the timeline next week at TechEd Barcelona!

vtns-comment-importer Jan 9, 2024

Originally posted by John Palmer on 2014-10-24 12:39

Hi Andrew, thanks for the reply. I'm not talking about OData specific REST calls but rather documented SharePoint (2013/Online) REST operations that do not work. Specifically, $skip does not work as documented here: http://msdn.microsoft.com/e...

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2014-10-25 07:21

Ah, now I see your point. Yeah, so agreed that does stink as I've seen that as well. If only we ran the world... :) Hopefully OData v4 support is coming soon!!!

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by Balaji on 2014-11-18 08:22

how can i convert this example to work with Typescript - more specifically is there an equivalent to the "metadata helper js" file in typescript?

0

1 reply

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2014-11-18 11:30

I don’t have anything and I don’t think the Breeze ship a TypeScript sample… but it shouldn’t be hard to build.

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by Ashish Patel on 2014-12-30 09:26

HI Andrew, BreezeJS looks promising. Does it work with data types such as Person or Managed Metadata fields?

0

3 replies

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2014-12-30 09:32

Directly no it doesn't... But under the covers those are just Lookup fields and the REST API respects them all the same. You just have to do some linking up on your own.

vtns-comment-importer Jan 9, 2024

Originally posted by Ashish Patel on 2014-12-30 09:54

Thanks for quick reply. So for person field I have to make call ensureUser first and pass on the lookup Id. But from my reading, it seems REST API's does not work with Managed Metadata types of fields. Have you dealt with that? What's the best alternative if that's the case.

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2014-12-30 13:58

I have, but it’s been a while and I can’t recall when / what I did. Best bet: Google & Stack Overflow :)

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by somdeep on 2015-01-20 08:15

Hi Andrew,

Thanks for the great post. However can you please let me know if we can create the same breeze wrapper around Shakrepoint 2013 JSOM. We have a requirement of querying the Enterprise Managed Metadata. As REST API's are not available to access the Managed Metadata so can we create a custom wrapper with Breeze around JSOM.

Thanks

0

2 replies

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2015-01-21 20:14

I guess technically you could, but that would be a lot of work. The DataServiceAdapter we wrote works with the REST API… not with the JSOM… so you’d have to completely rewrite that part… not a trivial thing.

vtns-comment-importer Jan 9, 2024

Originally posted by somdeep on 2015-01-30 07:27

Thanks a lot Andrew for your valuable response...

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by ankur garg on 2015-02-25 05:33

I tried this sample. SaveChanges method is not working. When i debugged the code. i found one error in Breeze sharepoint adaptor "missing the extra metadata for an update/delete entity" . I found one article referring to this http://stackoverflow.com/qu... which does not give an answer to this error. Please assist me.

Thanks

0

9 replies

Show 4 previous replies

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2015-02-25 08:29

Watch my repo / blog / twitter… I hope to have time in April prior to a conference where I’m showing Breeze again to go back and do a lot of enhancements to the data service adapter. No promises… it is open source so you can always jump in and contribute :)

vtns-comment-importer Jan 9, 2024

Originally posted by ankur garg on 2015-02-25 08:36

thanks a ton. But I have still little confusion as to why my update delete code is not working and working for you.. in which this bug will arise. Please clarify.

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2015-02-25 08:40

I haven’t seen (but please don’t send as I’m swamped right now) your code so I am not 100% certain. As the the bug I referenced above indicates, the adapter is assuming the type name of the entity that comes back… but the assumption is not correct 100% of the time.

vtns-comment-importer Jan 9, 2024

Originally posted by ankur garg on 2015-02-26 00:51

Hi Andrew,

Please suggest where i can find the documentation related to API. Various methods and parameters information.

Thanks

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2015-02-26 04:53

http://www.getbreezenow.com/

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by Arnold G on 2015-03-13 18:28

I pulled this code and configured it to run on my Office 365 business account and when I deploy the solution, after I logon, then VS 2013 gives the error: Unhandled exception at line 7 App.js jQuery is undefined. This prevents the buttons from being activated and the application to fail. I went to NuGet and can see that jQuery 2.1.3 is installed in the solution and there are references to it in the AppManifest.xml and the Package.package file. My Office 365 account is stock with no modifications done to it. How do I solve this problem? Thanks.

0

3 replies

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2015-03-14 05:24

Not sure exactly what they problem is as that’s not enough info to understand the error, but if you used my sample, it’s an app so just uninstall the app to get rid of it.

vtns-comment-importer Jan 9, 2024

Originally posted by Arnold G on 2015-03-16 10:29

Andrew, I looked in the Pages/Default.aspx file and found that the include line for jquery was coded to include jquery-1.9.1-min.js but this version was not in the /Scripts/ folder, version 2.1.3 was there. I changed the include line to point at 2.1.3 and all errors went away and the sample works.

I just received a work assignment to create pages for our SharePoint farm using Angularjs which we followed your PluralSite class source code to help setup our environment. I am all over your samples and blog entries to come up to speed. The CORS support for Office 365 is exciting and I can't wait to get to use it. Keep up the good work!

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2015-03-16 10:45

Thanks! As for the jQuery reference, it’s just the reference. When I built the samples the latest version of the jQuery NuGet package was the one I referenced, so if you updated the NuGet packages or created your own project with a different version (which I suspect you did), that’s why you’ll get bad references.

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by JuzKuz on 2015-03-17 20:25

Thanks for the post!

Do you happen to have an example of how to leverage this within a Jasmine test? I have the Angular part working, but it's never completing the Breeze 'then' statements within my Jasmine 2.2 tests... I added the 'done' call to the end of the call inside my 'beforeEach' (where I'm trying to call for data)... but I just don't think that I'm getting the Breeze service to actually make the calls within the tests since its a dependency of this service... which is a dependency of my app... I've gotten to the second tier, but not the third... ANY help would be appreciated. (yes, I'm also using the $httpBackend to hijack the calls - but it never seems to make them from the breeze service...)

THANKS!

0

3 replies

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2015-03-18 07:00

Sorry, but I don’t have a test handy…

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2015-03-23 15:50

If you look at the Breeze site, they have a whole article explaining how they do testing. They don't use Jasmine, but you should be able to deduce what they do.

vtns-comment-importer Jan 9, 2024

Originally posted by JuzKuz on 2015-03-23 17:56

Thanks, Andrew - I got it figured out already. The complexity is in the $timeout and $http services. When mocking them within Angular (using their mock module), you have to explicitly flush the async nature of them using either $timeout.flush() or $httpBackend.flush();

Once I got that figured out, it all worked. My question above assumed that I was not loading the dependent services - but that was not true. I was indeed getting the dependent services loaded in my mock, it's just that they were using either the $timeout or $http services (or $resource)... which must be flushed due to how angular creates the mocks for testing.

Just thought I'd post a little more in case someone else runs into this.

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by Hamid on 2015-10-27 03:20

Great Article Andrew,

Could you suggest if it's possible to access a lookup column from the list via data properties in breeze, an example would be very useful. Thanks

0

0 replies

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by nigel dewar on 2015-11-03 21:58

Hi Andrew, I've scoured the web and tried a myrid of things, but I cannot figure out how to include a person column with breezejs. So one can get back ModifiedBy info for example. I am accross the fact that one queries using ModifiedById and that its datatype specified in breeze entity is type : breeze.DataType.Int32

But of course then one must navigate to get all the other info back , like the persons name etc.

Im assuming one must setup a new entity and add to breeze metadata store that accesses the user information list, but I cannot figure out how this would look or work. there seems to be zero info out there on this either, which is strange.

Do you have any examples anywhere using breezejs where the person column type in sharepoint is used?

0

1 reply

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2015-11-07 11:25

A person column is just a lookup column under the covers so you’d have to treat it like that… I haven’t done this in the past though.

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by Nahid Hasan Kakon on 2018-06-11 04:59

Hi Andrew,

How to upload a file using breeze in sharepoint list.

0

3 replies

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2018-06-11 14:25

Sorry… don’t know offhand. I’d check their docs / forums.

vtns-comment-importer Jan 9, 2024

Originally posted by Nahid Hasan Kakon on 2018-06-20 06:43

Any update?

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2018-06-20 06:48

No… I’m not researching / actively using Breeze at this time. This post was pretty old. Please check the BreezeJS documentation: http://breeze.github.io/doc-js

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by Nahid Hasan Kakon on 2018-06-20 06:42

Hi Andrew,

How to update multiple record using a single request using breeze in sharepoint.TIA.

0

1 reply

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2018-06-20 06:47

Please refer to the BreezeJS documentation for working with batches: http://breeze.github.io/doc...

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by Rajendra Prasad on 2019-02-21 00:38

Hello Sir,

Can you tell me how to insert a record in share point list using Breeze Rest api ??

0

0 replies

vtns-comment-importer](https://github.com/apps/vtns-comment-importer) Jan 9, 2024

Originally posted by Rajendra Prasad on 2019-02-21 21:40

Hello Sir

Can you tell me CURD operations from share point list using BreezeJS ?

0

3 replies

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2019-02-22 05:17

That’s what this post is about. You can learn more from the Breeze docs.

vtns-comment-importer Jan 9, 2024

Originally posted by Rajendra Prasad on 2019-02-26 06:23

Thanks you Sir

I went through your Breeze docs but not able to insert,update and delete the records I only fetch data through using breezeJS.

Delete a record Code here -

--------------------------------------

// deletes the last item in the list

function deleteItem() {

// delete the last item in the list

breeze.EntityQuery

.from(EmployeeType.defaultResourceName)

.using(entityManager)

.execute()

.then(function (response) {

var results = response.results;

var lastContact = results[results.length - 1];

lastContact.entityAspect.setDeleted();

entityManager.saveChanges().then(function (res) {

alert('last item in list deleted');

}, function (error) {

console.log(error);

});

});

}

Note:- above code is there but I am not able to delete record BreezeJs using sharepoint list and in this not working this code-- lastContact.entityAspect.setDeleted();

vtns-comment-importer Jan 9, 2024

Originally posted by Andrew Connell on 2019-02-26 06:52

I’m sorry but it’s been a very long time since I worked with Breeze so I don’t have much to offer. I’d recommend you post questions to StackOverflow or to a Breeze specific forum.

TAGS

newsletter

Join 12,000+ developers for news & insights

Subscribe Now

No clickbait · 100% free · Unsubscribe anytime.

[Development](/content/tags/development/ "View all posts tagged with 'Development'"/index.html) [Microsoft 365](/content/tags/microsoft-365/ "View all posts tagged with 'Microsoft 365'"/index.html) [SharePoint](/content/tags/sharepoint/ "View all posts tagged with 'SharePoint'"/index.html) [SharePoint 2010](/content/tags/sharepoint-2010/ "View all posts tagged with 'SharePoint 2010'"/index.html) [SharePoint 2013](/content/tags/sharepoint-2013/ "View all posts tagged with 'SharePoint 2013'"/index.html) [SharePoint 2016](/content/tags/sharepoint-2016/ "View all posts tagged with 'SharePoint 2016'"/index.html) [SharePoint 2019](/content/tags/sharepoint-2019/ "View all posts tagged with 'SharePoint 2019'"/index.html) [SharePoint SE](/content/tags/sharepoint-se/ "View all posts tagged with 'SharePoint SE'"/index.html)

BreezeJS makes client-side SharePoint REST dev easy.

March 4, 2014 [Read now](/content/blog/breezejs-makes-client-side-sharepoint-2013-rest-development-a-breeze/ "Read: BreezeJS makes client-side SharePoint REST dev easy."/index.html)

[Microsoft 365](/content/tags/microsoft-365/ "View all posts tagged with 'Microsoft 365'"/index.html) [SharePoint](/content/tags/sharepoint/ "View all posts tagged with 'SharePoint'"/index.html) [SharePoint 2013](/content/tags/sharepoint-2013/ "View all posts tagged with 'SharePoint 2013'"/index.html) [SharePoint 2016](/content/tags/sharepoint-2016/ "View all posts tagged with 'SharePoint 2016'"/index.html) [SharePoint 2019](/content/tags/sharepoint-2019/ "View all posts tagged with 'SharePoint 2019'"/index.html) [SharePoint SE](/content/tags/sharepoint-se/ "View all posts tagged with 'SharePoint SE'"/index.html)

Kirk Evans SharePoint 2013 Tokens Fiddler Extension

November 21, 2013 [Read now](/content/blog/inspecting-the-sharepoint-oauth-token-with-a-fiddler-extension/ "Read: Kirk Evans SharePoint 2013 Tokens Fiddler Extension"/index.html)

Microsoft Deprecates User Code Part of Sandboxed Solutions

September 10, 2013 [Read now](/content/blog/sharepoint-clarification-on-the-current-state-future-of-sandboxed-solutions/ "Read: Microsoft Deprecates User Code Part of Sandboxed Solutions"/index.html)

bi-weekly newsletter

Join 12,000+ Microsoft 365 full-stack web developers for news, insights & resources. 100% free.

Subscribe to Andrew's newsletter for insights & stay on top of the latest news in the Microsoft 365 ecosystem!

Subscribe me for FREE Now

No clickbait · 100% free · Unsubscribe anytime.