Update on SharePoint and Office Development - 2016 Feb edition

We rotate through different topics and presenters in the Sydney SharePoint user group.  But I finally got my turn to present a developer topic, and I wanted to do a quick primer on all things Office Developer related.

This turned out to be a REALLY complex talk.  I wanted to cover ALL the cool new stuff in Office Dev.  But as it turns out every month (and now, every week) new things come out. 

I ended up with:

  • Brief Introduction to dev.office.com
  • Brief Introduction to PnP
  • Where we have been with SharePoint Add-Ins
  • Where we are going with Office Addins: 
  • NEW API: Microsoft Graph API
  • NEW AUTH: OAuth 2.0 and ADAL(js)
  • NEW TOOLS: New tools with Node, NPM, and Yeoman Generator (YO OFFICE)
  • Build a demo Office Addin that talks to both SharePoint Online and Microsoft Graph
  • Run on web and desktop

The presentation clocked in at 1 hour and 20mins - I started a bit earlier.  And kind of flopped off at the end as I run out of steam after the demo :-O

Then we gave out all the swag from dev.office.com so all is happy faces.

The PowerPoint presentation is here:

2015 February Presentation - Update on SharePoint and Office Development

 

Demo Fail

So at the end, the Office Add-In didn't load from the App Catalog on my desktop.  I went home and got it to work, here are screenshots to proof it.

Oh NO - no apps

Add SharePoint App catalog to trust center

 

Here it is.  The same addin working on desktop - talking to Microsoft Graph and showing Group Conversations

 

Publishing UserCustomActionConfigPage on GitHub

I wrote previously about the Simplest way to add script to your SharePoint and SharePoint Online.

Although this is a simple, stand-alone page, it is something I can see being updated going forward, and with some minor prodding from Marc Anderson, I moved forward my plans to put it out there publically.

It also means I can now just link to that one place, and as I make updates to the page, people won't be going to the old version 1. 

It's here on GitHub.  https://github.com/johnnliu/UserCustomActionsConfigPage 

I still have a few more articles on branding that I wanted to write under this banner and I think Marc is going to link it up with requirejs. 

 

Creating Multiple Custom Email-Alias Addresses with one Outlook account

Update thank you to Johannes in the comments.  This is called Email Sub-Addressing.

I was catching up with my brother, and he showed me a pretty cool trick with gmail.

If you mail [email protected] (not his real email address) with mark-liu+test@gmail.com - the email would arrive at his inbox.

Not to be outdone, I tested this with Outlook, and sure enough.  If you mail: john-liu+test a outlook dot com they'd arrive in my personal mailbox.  You can do anything after the + character.  +spam, +newspaper, +test1 etc etc.

I have no idea what this feature is called - for Gmail it seems to be called "Creating Multiple Custom Email Addresses with one Gmail account".  May be this is called Email-Alias? 

So this is just a short blog about an Outlook version of this feature.  This works for Hotmail as well.

What is this good for?

  • Test throw away emails, e.g. testing your registration process code
  • Spam emails and figuring out where they came from
  • Easy to set up filter rule to get rid of emails you don't want
  • You should definitely have a john-liu+spam alias for signing up to newsletters.

Notes

  • Doesn't work for Exchange or Office 365 email addresses.

Thank you MS for MVP 2016

As I still see myself a newcomer in the SharePoint community compared to our many elders, I still hold my breath every year come Jan 02 when my MVP gets renewed.  I'm told "if they weren't going to renew you they'll break it to you early" I hope so.  I'm still holding my breath anyways.

I received my Microsoft MVP award for the 3rd year on the morning of the 2nd.  I wanted to say a big thank you to the community and Microsoft.  Cheers for Team Office and Friends!

2016 is the year where Microsoft tweaks the MVP award system - for IT Pros and Developer MVPs, it is no longer based directly on specific product, but on the product group.  Instead of SharePoint, I am now Office Servers and Services.  I think this is a good thing, in that I was already contributing in different areas - I love Sway, and love love Power BI, at the same time I want to see SharePoint's Sites even more embedded within Office Add-Ins.  Where will SharePoint go in 2016?  Will it end up on HoloLens?  Wow who knows.

But know this, SharePoint is not going away not by a long shot.  This is the year where I think we will see that MS is serious about SharePoint, and not just a service, but also a platform.  Trust me, I'm a dev...  A hopeful dev.

And as Microsoft moves forward with single purpose: unifying Azure, Windows, Office and Bing engine, as well as advancing the devices with IOT, Xbox, Surface and Band, I have this uncanny grin as I imagine what we could build, not in 5 years' time, but this year, in 2016!

Loving the ecosystem, loving the possibilities and loving the community.

/omg2016gonnabeawesome

Set Window Title in Nintex Forms for O365

Disclaimer.  This post is about an unsupported hack.

Over at Nintex Community (registration required), there was a question about how to change the Nintex Form for Office 365 window title.  So a user can differentiate the different forms.  Here's a picture that shows the problem.

My buddy Dan Stoll poked me all the way from America in some ungodly hour.  But in my delirious state, I still remember I wanted to write about window.postMessage this year and the problem seems related.

So I went and did some

Investigative Digging

My Office 365 Form is hosted on

https://johnliu365-724b9f945a8c4d.sharepoint.com/FormsApp/NFLaunch.aspx?...

The form part itself is hosted on

https://formso365.nintex.com/Pages/FormsPart.aspx?...

Because the domains are different - JavaScript within the form can not affect the parent window.  So, as noted in the community thread:

window.parent.document.title = "test"; //wouldn't work

To go beyond IFrames, we need to look for PostMessage - this method allows javascript from any frame to send messages to another frame.  The drawback?  The parent page has to be listening to it - otherwise it'll just be discarded.

So I find the FormsPart (child) page, has this function

PostMessageToParent("openWindow", urlToOpen);

That posts json messages to the window.parent frame.  In the form:

{
  action: “openWindow”,
  data: “urlToOpen”
}

And NFLaunch.aspx (parent) page has these functions:

// first receive here
var onmessage = function (e)...

// then here
var SPAppIFramePostMsgHandler = function(e) ...

The function seems to only handle resize.  But I have an idea how to go on.

Hack

Remember, you can only hack what you have control over.  In this case, you have your own Tenant. 

1. Pop open NFLaunch.aspx
Tip:  go to https://johnliu365-724b9f945a8c4d.sharepoint.com/FormsApp/_catalogs/masterpage/
Then you can open in explorer via WebDAV
Then in explorer, navigate back up to root


2. Insert this helper function to 'listen' to a particular setTitle message.

//take a peek at the data send up, handle "setTitle"
//is totally unsupported by nintex
//read about this hack at http://johnliu.net/blog/2015/12/set-window-title-in-nintex-forms-for-o365 
var peekData = JSON.parse(e.data);
if (peekData && peekData.action == "setTitle") {
    document.title = peekData.data;
}
//end peeking

3. Save NFLaunch.aspx

Now back in the Nintex Form Designer

4. Send messages from the child to the parent

Result

Check out the Window Title!

Summary

  • Nintex Forms already do a bit of messaging between Frames
  • We piggyback it to send our own message
  • Needs a small unsupported hack in the parent form
  • If child form sends message that nobody understands at the parent level, nothing would happen.  So the hack should be quite safe.

Happy New Years

On the last day of 2015, I hope the year has been good to you.  Here's to an amazing 2016 and I'm sure there will be much joy from Microsoft, SharePoint and partners like Nintex and us at SharePoint Gurus.