August 27
Introduction to the Module and Revealing Module Patterns in JavaScript

Introduction to the Module and Revealing Module Patterns in JavaScript

Although I've been a developer for almost 10 years, I've always felt that my JavaScript skills were falling behind. I could do the basics but I never realized how awesome JavaScript actually is. As a SharePoint Intranet developer, I mostly dealt with C# web parts, event receivers, workflow, etc. The back-end stuff. However, with the direction SharePoint is moving, development on it is dramatically changing. For On-Premise environments things are still pretty much the same as before, however with everything moving into the cloud, clients want to be ready for the transition. This means that we need to write code that will easily transfer/upgrade into the cloud even when we are developing for On-Premise environments. That means JavaScript. And lots of it. Therefore I really need and want to improve my JavaScript skills and so should every SharePoint developer.

That brings me to the topic of this blog. JavaScript. Now I am definitely not even going to attempt covering all the awesomeness that is JavaScript, I am still a cub learning my ways myself. I just want to introduce you to the basic principle of two common patterns namely The Module Pattern and The Revealing Module Pattern. I feel that these, or at least one of them, are crucial to any JavaScript development. Big project or small project, they help you structure and separate code to be cleaner and easier to get into. Using this, you can implement multi-tier architecture within pure JavaScript applications such as SharePoint Add-Ins (formerly known as Apps. see https://msdn.microsoft.com/en-us/library/office/fp179930.aspx)

 

The Module Pattern is basically how you define classes in JavaScript with private and public variables and functions. With this pattern, you have to new up an instance of your 'class' and access the methods and variables that are public via this instance. Sounds a bit like a Non-Static class to me.

The Revealing Module Pattern is very similar, however you don't need to instantiate it and you explicitly expose public things by means of a return. Sounds a bit like a static class.

Examples can be found here or read more on design patterns on Carl Danley's series on JavaScript Design Patterns: https://carldanley.com/javascript-design-patterns/

 

July 22
New Visual Studio is Out

Everyone loves getting an IDE upgrade and, well, finally the newest version of Visual Studio, 2015, is out. If you have an MSDN membership, you should find the IDE's in your ​​MSDN downloads page.


What's impressed me is that it now has the ability to debug lambdas. With how useful lambda's are are, you really should be improving your Linq-fu and now you can get better insight to what they're doing.

A really handy feature is the test features. VS now runs your tests from the editor and report on them in the editor, too. Clicking on the result shows the test output, like this:
Visual Studio 2015 Tests.png

​It has the standard fare of what you'd expect from a new version of VS:

  • More supported languages and language versions (In particular, MS seems quite chuffed with the iOS and Android support).
  • Support for newer version of C#
  • Better built in refactor tools, which are very R#​esque: there's a lightbulb that suggests changes that VS can do for you. I doubt this suite really holds a candle to R#, but it's a nice direction to see Visual Studio heading in.
  • More project options
  • General tweaks to existing functionality

I'm enjoying this new version. How are you finding it so far?
July 21
So, You Want to Build an App for SharePoint 2013 Online?

To put this in context, this is specifically how to create a remote event receiver that is hosted on an Azure website. That said, I'll attempt to isolate the parts unique to my situation. This post is basically an amalgamation of good resources that took me too long to find online.

 

Step 1: Set up Hosting Environment​

If you're specifically not using an Azure site, at this point set up the environment where you will host your web service.

Go to your Azure Management Portal.

This is to create the above mentioned website. If you don't have one, an MSDN subscription gives you access to Azure. Azure can be activated from your MSDN account at: https://msdn.microsoft.com/en-us/subscriptions/manage/default.aspx 

Note about Azure: As with anything Azure related, turning up the cost dial turns up the features allowed. I found that a free website is more than good enough for development.

Once you're in your portal, simply quick create a website. While you're there, in the website's dashboard, you'll find a "quick glance" section. Click on "Download the publish profile." You'll need it later.

You should now have a <yoursitename>.azurewebsites.net website (or your own domain name if you felt like paying) and a publishing profile to use later.​​

 

Step 2: Generate App Registration Details

Go to your SharePoint Online Site.

Look at your address bar. You should see something along the lines of

Replace everything from "start" onwards with "appregnew.aspx" and you should have something like https://<tenantsitename>.sharepoint.com/sites/<yoursitename>/_layouts/15/appregnew.aspx

The form you now see is how to register an app for a site. I only much later realised that these details are tenant specific, so you will have to repeat this part if you ever want someone to install your app on their tenancy (for ease of understanding, old SP used "farms," SP Online has "tenants").

The form has some generate buttons.

Note about Redirect URI: This is the default web page for your app that Visual Studio will create for you later in the process. If you'd like a different page, change it now and don't forget to change the page yourself later)

Click "Create." KEEP THE RESULTING PAGE or copy the details, you will need them later.


Step 3: Configure Azure

Go back to your Azure website.

The really awesome thing about Azure websites is their immunity to external influence. You have no way of updating the config of your website from Visual Studio. Instead, you need to:
  • ​Click on config
  • Scroll down to "app settings"
  • Enter a new Key: "ClientID" and Value from Step 2
  •  Enter a new Key: "ClientSecret" and Value from Step 2
  • Save

 

Step 4: Create Project

Open Visual Studio 2013 (or VS2012 with Office Dev Tools, but seriously go get VS2013).

This is largely adapted from http://www.codeproject.com/Articles/636058/Adventures-with-SharePoint-2013-Remote-Event-Recei (You get my click-by-click version for simplicity)

  • File->New->Project…
  • App for SharePoint 2013->(name it what you will)->OK
  • (Enter your SharePoint site from Step 2)->Provider-hosted->Next->Next->Finish

 

You can stop there if you just want a Provider-hosted app. If you want a remote event receiver:

  • Right click your SP app project->Add->New Item…
  • Remote Event Receiver->(name it)->Add
  • (pick the settings you'd like for the RER)->Finish

 

If you would like your code to do something on install (such as attach your remote event receiver to a list on the host web):

  • Click on your SP app project->Set Handle App Installed to True

To attach the receivers programmatically (in this case to a document library):

  • Change the code in AppEventReceiver.svc.cs (the code in if (clientContext != null) )to:


var documentsList = clientContext.Web.Lists.GetByTitle("Documents");

clientContext.Load(documentsList);

clientContext.ExecuteQuery();

 

string remoteUrl = "https://<yoursitename>.azurewebsites.net/Services/<yourRERname>.svc"; 

 

EventReceiverDefinitionCreationInformation newEventReceiver = new EventReceiverDefinitionCreationInformation()

{

    EventType = EventReceiverType.ItemAdded,

    ReceiverName = "<yourRERname>",

    ReceiverUrl = remoteUrl,

    SequenceNumber = 1000

};

 

documentsList.EventReceivers.Add(newEventReceiver);

clientContext.ExecuteQuery();

 

At this point I should mention that there are –ed (async) events and there are –ing (sync) events. For your own sanity, default to async events unless you specifically require synchronous events.

Step 5: Configure App

Remote Event Receiver Url

 

AppManifest

  • In the SharePoint App project, open AppManifest.xml.
  • Set your permissions (at least web and list at manage from my Step 3).
  • Hit F7 to get to the juicy code underneath.
  • Replace both instances of ~remoteAppUrl with https://<yoursitename>.azurewebsites.net
  • Change the ClientId of RemoteWebApplication to the generated one from Step 2.

 

Step 6: Publish

  • Right click the SharePoint app project->Publish…
  • Current profile dropdown-><New…>
  • Browse->File from Step 1->Open->Next
  • Enter Client ID and Client Secret from Step 2->Finish
  • "Deploy your web project"->Publish->Wait for "Publish succeeded"
  • "Package the app"->Add and "s" to make "https"->Finish​

 

Step 7: Add App to App Catalog

In SharePoint Online, go to your app catalog.

  • If you're not sure where that is, you probably don't have one, so create one:
    • Go to admin->​SharePoint->Click on apps-> App Catalog->OK->(Enter details)->OK
  • In the catalog site, go to Apps for SharePoint.
  • Drag and drop your .app file from Step 5 here.

 

Step 8: Enjoy

At the site you'd like the app, go to Site Contents and add an app.

Click on your app. This will install it.

You should now have a working app. Enjoy :)​​​

(If it fails during installation, it indicates that some part of the config is wrong. If you do run into that, let me know so I can make sure my post hasn't led you wrong. )​​

July 13
ReSharper vs StyleCop

If you use Stylecop and hate having to make tiny formatting changes all over your code, you probably use Visual Studio's built in command to format your document (default: ctrl+K, ctrl+D).

 

If, however, you use ReSharper, you'll find that it has a more powerful formatting tool (default: ctrl+E, ctrl+C). "What could go wrong?" you ask? Well, ReSharper and StyleCop don't play nice by default. Luckily for you, I've forced ReSharper'ssettings​ to conform to StyleCop.

 

You can download the settings file here. You'll need to replace the file in C:\Users\{Username}\AppData\Roaming\JetBrains\Shared\vAny and you're good to go.

You'll want to close Visual Studio before doing the file swap. It doesn't seem to break anything, but if you don't, it displays the message "Catastrophic failure," use that as you will.

 

One caveat: I'm fairly new to ReSharper, so there are likely a few cases I've missed. In that case, just comment or mail me and I'll alter the settings file accordingly.

 

Now go out there and write good, pretty code.​

July 09
Language Variations and SharePoint - Hidden Gems

​So, you're implementing SharePoint language variations and you have a feature or a workflow or something that needs to run on the pages library.  Funny story about SharePoint and variations and the pages library, it translates the word pages for the Roman Alpabet languages, but not for the other languages.

Now, you need to get hold of the pages library.  You might think, "well, that's simple, I'll just get the word pages out of the resource files".  Suuuuure.  That will work if all that you have is Roman Alphabet languages.  But lets say you have Arabic.  The Arabic word for pages does not translate into anything a browser can understand.  

Save yourself some time, there is a function in the PublishingWeb class that will give you the answer:

PublishingWeb.GetPagesListName(web);  //Where web is the SPWeb object you are working with.  

PowerShell example:

Spanish:
$w = Get-SPWeb http://sasolintranet:2000/es-es
[Microsoft.SharePoint.Publishing.PublishingWeb]::GetPagesListName($w)
Paginas

Arabic:
$w = Get-SPWeb http://sasolintranet:2000/ar-sa
[Microsoft.SharePoint.Publishing.PublishingWeb]::GetPagesListName($w)
Pages

German:
$w = Get-SPWeb http://sasolintranet:2000/de-de
[Microsoft.SharePoint.Publishing.PublishingWeb]::GetPagesListName($w)
Seiten​

Hope this helps someone out there!

June 18
A Tribute to our Youth

Britehouse Youth Day 2015 

I started as a Learner at Britehouse. Learning within Britehouse has taught me to build on​ strengths, take on new challenges and tak​e my career in new direction. Being a Britehouse youth employee is AWESOME.​​

Margaret Madihlaba, Finance Administrator​​​

This is how Margaret Madihlaba, Finance Administrator describes her employ here at Britehouse. And, she’s not the only one.

Th​​e working environment here at Britehouse is a warm and welcoming one.

Lethabo Ntshudisane

The people around Britehouse have been kind and willing to help.

Avile George

I’ve been learning non-stop, and every day is fun to be here. Britehouse took care of me as one of its employees.

Alexander Venter

I have blended with the Britehouse family because of the remarkable welcome I have received and I feel like a permanent employee already.

Sipho Khumalo

I really enjoy the work vibe, experience, and the working environment.

Cardwell Mohlala

I come very far every day but it doesn’t matter. I don’t regret my time here.

Siphokazi Tshiza

I have been with the organisation for 10 Months. My Britehouse Journey has been unique, promoting self-awareness, accountability and leadership skills, with clear pathways for career development and personal growth.

Ernestina Masola, Junior Accountant for Shared Services

As we have recently​ celebrated South Africa’s 21st Youth Day (16th June 2015), it’s worth looking at the kinds of learning that our young interns have highlighted as being important to them.

Although they’re not saying it in so many words, our employed youth are helping us understand that, in spite of 21 years of democracy, the vast majority of people still have no real experience of professional workplaces and that, therefore, their children need proactive help in figuring out how to make a positive contribution to their places of employment. Having an education gets you out of the starting blocks, of course. But, once you leave academia, there is just so much other learning needed to help you run the race of life successfully, confidently, and with the zest that makes going to work a pleasure.

I have gained lots of experience in terms of effective communication among colleagues.

Cardwell Mohlala

One must be open to change. With technological advances being made on a daily basis, it is crucial to be open to change in this line of work.

Prudence Masilela

I have learned to work with people as team. I have also learned about behavior in the workplace.

Desmond Maluleke

Since coming to Britehouse, I have learned a lot of things, such as communication skills, team work, and professionalism.

Sympathy Mmola

I experienced how to work with colleagues and as a group in order to produce effective work. Also how programming works in real life. How departments communicate with one another and how to behave in the workplace.

Portia Mphela

I have experienced many new things, like good communication in the work environment and working together as a team.

Thami Mpungose

It is a good thing for me to learn every day and deliver what is expected of me.

Tshepo Koee

I have learned how to update a database, telephone skills, communicating with other people - and even how to do packs for the clients.

Lebogang Raluthaha

My learning journey at Britehouse has given me an opportunity to develop my personal skills. I have developed my confidence and self-belief to succeed. It has been a transformational challenge that has helped me to grow and I am looking forward to many more years.

Tsepiso Mofokeng

So many of us ‘old hands’ take these kinds of things for granted. We’ve forgotten how scary it was to walk into our first ever place of employment, collaborate, meet deadlines, and take responsibility for outcomes. Most of us had the privilege of parents who had been down the workplace road before us. Even though we were newbies, the world of work was not strange to us.

I want, therefore, to thank everyone who gives a helping thought or word to our learners. The legacy of empowerment you are creating will be passed on from each set of learners to all the generations that follow them.

And, to our learners and employed youth, all of whom have not been quoted, thank you for giving all of us at Britehouse the personal opportunity to do something of tangible value for our fellow South Africans.​

​​​
March 28
Brand Launch

​The Britehouse Group is lighting the way to the future for all large and mid-sized businesses across Africa. For many years, Britehouse has focused on offering its clients application and data solutions through a range of business models and technologies.

 


Now, though, Britehouse has proven it doesn't just keep up with what's on trend. It is effectively already in the future, with a strategic refresh of its organisational structure, improved offering, and updated brand presence. Where the structure previously included companies known as Automate, Firestring, Eliance, Compubrand and 3Fifteen, it has been streamlined and elegantly branded as one, unified Britehouse Group.

Read more
​​

Follow Us

Stay in contact by following us on the following soci​al networks.