SharePoint 2013/online – CRUD operations using AngularJS and REST

I’ve been developing some apps using AngularJS and REST.

Doing some Googleing I noticed that most developers use jQuery Ajax to make REST requests, however if you do that, you will miss out on some awesome AngularJS features.

First of all, you should check out this post on how to refresh the form digest value. You need the digest value to do CRUD operations or SharePoint will deny your requests.

Let’s create a SharePoint list with some custom fields. Note that the field internal names will be different from the display names, just to make the development easier.

(more…)

SharePoint – Refresh Form Digest Value using AngularJS and REST

Background

When working with SharePoint 2013/online, REST, CRUD and SPA you will need the Form Digest token. This a unique key based on user and and site and it’s only valid for a limited time.
Wictor Wilén wrote a very good post about it here

Problem

We have an App that is not using a master-page which means that the Form Digest value won’t update nor exist as a hidden input element. This means that we can not retrieve it using $(‘#__REQUESTDIGEST’).val(). Also, I have not been able to update the Digest value using UpdateFormDigest(relativeUrl,interval) from init.js.

Solution

Now, let’s build a service in AngularJS that will handle the Form Digest value for us and automatically update it with the same refresh rate as it would in the master-page. If you check the js-variable  _spFormDigestRefreshInterval on a page based on a master-page, you will find the value 1440000 (ms), which means that the Form Digest key will update every 24 minutes.

(more…)

SharePoint Online – Change the Title of the newsfeed in the SiteFeed WebPart

My colleague has created our intranet in SharePoint online. Using standard features in SharePoint we wanted to have a Wall feature (like Facebook) where users could post what ever they wanted.

We decided to use the SiteFeed WebPart. This is a WebPart which is unique for every site, using SharePoint list called “MicroFeed” to provide data. This is the same way as the Microblog is used on MySite.

The SiteFeed WebPart looks quite good and it provides all the functionality we wanted for a Wall feature, such as comments, likes, tagging people and other social stuff.

The problem

The SiteFeed Title “Neewsfeed” can’t be changed. This is NOT the title of the standard WebPart control, this is a built in title in SiteFeed WebPart. This title is not hard-coded, but it’s located in a predefined resource, profilebrowserscriptres.resx, which requires hive-access to change. See this blog-post for more information about the resx. Bare in mind that changing the resource will change the SiteFeed Title everywhere.

The WebPart has Chrome Type none by default, which means that the standard WebPart Title won’t be displayed.

Ok, so let’s try first to change the built-in title with JavaScript.

(more…)