Philly .net Code Camp Follow-up

A quick post to list a couple of resources mentioned in the session today.

First, if you are starting Office development for Office 365, Office or SharePoint Add-ins you need to start with dev.office.com. 

Second, the code presented is up on my gituhub repository. This contains the final code I showed today.  You do need to update the web.config with the values for your tenant.

Finally, keep a look out for video of the presentation.  I will post a note here, so subscribe if you are interested.  The video will be a number of smaller videos focusing on some aspect of the presentation.  This will allow me to go into better depth for some of the more technical content.

There was a lot to cover in this session.  If you have any questions, please me t ne know.

Disable Automatically Extend Screen in PowerPoint

I’ve been to a few presentations where the speaker has run into this problem.  They are using PowerPoint with their device and a projector.  They start the SlideShow, which puts the display into ‘Extend’ mode.  They then need to switch out temporarily to another application during the presentation, but the device remains in Extended mode.  It does not automatically go back.  So on the presenters screen they see the application they wanted to discuss, while the audience is looking at an empty desktop.  Happened to me during a recent presentation too and I ended up just staying in PowerPoint application and ‘Duplicate’ mode.

Thanks to Dan Hartshorn, this is no longer an issue.  Open the File | Options and click the Advanced item in the left menu.  Scroll down to display and uncheck the ‘Automatically extend display when presenting on a laptop or tablet.’  Click OK to close the dialog and accept the settings.

image

SharePoint Saturday: Unified API Demo Follow-up

I spent a good deal of time in my presentation using the graphexplorer2.azurewebsites.net to demonstrate the REST calls and the data available from the Office 365 Unified APIs.  I was able to fit in one demo that showed the configuration to Azure AD Services and the adding of the Office 365 Unified API preview application.  You can get the application from GitHub here.  The demo went well, right up to the last click. 

The last click was supposed to show the the list of files for the authenticated user pulling the content from the both OneDrive for Business and SharePoint all from the same API call.  The user was authenticated, but in clicking the ‘Files’ menu item, I received the following error.

Response_type token is not supported

The fix was easy.  The configuration tab for the application includes a Manage Manifest button.  This button downloads/uploads the manifest associated with the application and includes a number of more advanced configuration properties.  Included in these properties is the "oauth2AllowImplicitFlow" property, which is false by default.  Download the manifest, change this value to true, and upload the manifest.  You need to sign out and then back in or the setting to take effect.  Once this is done, the file information does again flow back out of Office 365.

One last note, if you are using IE and running in localhost, there is an additional error.

User account identifier is not provided.

This one is specific to running in this configuration, on IE and on localhost.  Changing one of the these configurations will fix this issue.  So move it to the cloud or view it in Chrome.

SharePoint Saturday: Building Applications with Office 365 Unified API

In October 2014, the Office 365 team released a set of APIs to communicate with the Office 365 platform. The API was great for reading and writing content.  It also integrated nicely with the Azure AD Services and the Active Directory Access Libraries (ADAL).  The API exposed specific features, mainly Mail, Calendar, Contacts and Files.  In addition, these same APIs provided a connection into the SharePoint site on your tenant.  Communication was mainly through REST calls, but the url for these services was different.  Mail, Calendar and Contacts all pointed to the https://office365.outlook.com/ url and Files and SharePoint used the url of the tenant of the authenticated person.  Helping to sort all of the urls out was the Directory Service, which given the authenticated user and the specific resource in question, would return the appropriate base url.

At Build 2015, the Office Dev team announced a preview of the next version of this API called the Unified API.  The Unified API stems all API calls from a common url https://graph.microsoft.com/.  The Unified API provides one token that is valid for all of the resources defined in the delegated permissions in the application configuration. 

I am giving a session on this topic at two SharePoint Saturday sessions in July, one on July 18 in Baltimore and the other on July 25 in NYC. 

The slides for the session are available on my OneDrive.  These started from the slides from the Build session, but edited for the content I wanted to present. 

Live Writer on Windows 10

I’ve mentioned my love of Live Writer before.  I had it running on previous Windows 10 builds including build 10130, but for me that build overall was pretty problematic.  Mainly the issues were sound and video related, but because of other minor issues and a heavy workload, I shelved using my Win10 until the build was updated from 10130.  This week, we received builds 10158, 10159 and 10162.  I’ve been pretty impressed with them so it is time to get Live Writer back on the machine.

On 10130 and previous builds, it was a matter of installing the .net Framework 3.5 and then the Live Writer app from the bootstrap installer.  On 10162, .net 3,5 can be installed from the Windows Features options.  As for the Live Writer app, the installer gave an error about OnCatalogResult.  I looked through some posts about this error and found this response is to download the full app and not the installer bootstrap.  The links in the article only have 2009 and 2011 as it was answered back in late 2010.  However, It was not to hard to determine based on the pattern what would be 2012 full version.  Downloaded it, installed it and using it to write this post.

Hopefully this type of work is only temporary as it sounds like this application may finally be available as an open source project. 

OneNote Screen Clipping and Internet Explorer Debugging

OneNote provides a great out of the box screen clipping feature.  Win+N and then S turns the screen opaque.  The mouse pointer becomes cross-hairs and selecting an area of the screen will capture the are to the clipboard.  There are other tools that can do a better job of this and provide more bells and whistles, but since OneNote is one of the first applications I install, it is available on every machine almost immediately.

I develop web applications, so I often have my browser’s Developer Tools open and running.  For javascript development, I mainly work in Chrome.  IE is coming along in this area, but at this point Chrome still is the tool for me.  In those instances where the bug only shows in IE, I can use the available developers tools to solve the issue.

I was working on one such IE specific issue recently.  I was having trouble with the function Date().toLocalDateString().  It returned a date string, which is what I wanted, but that string could not turned around to create a new date object.  It turns out this is a known bug in IE.  That’s great it is known, but I still need to fix it for IE. 

I wanted to capture a screenshot of the error.  I hit Win+N and then S.  Screen turned opaque and I selected the area I wanted.  What should happen next in my configuration is I get prompted with a dialog that asks what I want to do with the clipping.  Typically I send this to the Clipboard but it could go to a specific section of the notebook.  The dialog did not show.  I figured something got hung up in OneNote, so I closed out of it and the Screen Clipping tool.  Hit the quick keys, selected my screen and still no dialog.

Frustrated at this point I continued with my debugging and once I was past the final breakpoint, the OneNote dialog appeared.  I reloaded the page, hit a debug break point, took the screenshot and no dialog.  Again clearing the last breakpoint led to the dialog displaying.

I’m not sure what the relationship is at this point between the screen capture function and debugging in IE.  As you might expect, it is only an IE issue.  Debugging in Chrome and I would guess other browsers too did not produce the same issue.  This post is mainly to make you aware it exists so you don’t go crazy trying to find your clipping.  As for the date issue, I switched the function to use toDateString instead.

Connecting OneNote to WordPress

I’m a huge OneNote fan.  I’ve actively used the product since it was first released with Office 2003.  Even with the local storage of OneNote files, it was easy to pick things up and move to a new machine or rebuild when needed.  Take this to the current day and all of this content is stored in my OneDrive, so it follows me from device to device or from a machine rebuild and a login with my Microsoft Account.

I’ve also been a huge fan of LiveWriter.  It works with my WordPress.com site as well as SharePoint and other blogs.  There is a rich supply of add-ins created by a passionate community.  However, the last release is from 2012.  While it does continue to work well (I am using it to create and publish this post), people within Microsoft are trying to get this upgraded or at least moved to an open source project so the community can take over this product.  If you are interested, go to the link and retweet.

Note: if you are looking for LiveWriter, this blog post has the correct links.  Use this to get the latest version and not your favorite search engine.

So when the OneNote team announced that you ‘could connect OneNote to WordPress’, I was excited that this would provide an updated solution to posting content to WordPress.  I’ll be honest, I was truly disappointed in the solution. 

The solution is actually a plug-in for WordPress.  It contains files you deploy to your WordPress server and these files provide a toolbar icon in the WordPress post creation window.  This button looks at the OneNote instances stored in your OneDrive Personal only.  OneDrive for Business, SharePoint or local OneNote instance are not supported in this plug-in because of OneNote API limitations.  This may evolve in the future, but it is the current state.  Select the page that contains your blog post content and it appears in the WordPress textbox for you to continue editing.  It also looks like this solution is not available if your blog is hosted on WordPress.com. 

While it is great that this plug-in exists, this is not how I write posts.  I avoid the WordPress editor except when absolutely necessary.  Is it a bad editor, probably not.  It just does not fit into my workflow.  I jot down lots of ideas for blog posts in OneNote in sections for both work and personal and even use it to initial outline the content.  What I was hoping for was a OneNote ribbon button or side panel, where I push this content directly into WordPress once it is completed, much like LiveWriter does.  Yes, there is a method of publishing content from OneNote into WordPress, but it needs Word as the intermediary that creates a Word document and pushes the content and keeps track of your blog settings.  This may be because OneNote is very flat from a formatting perspective, and it needs to be.  Word can provide some interesting format options required for some blog posts.  However, I don’t need a Word file in addition to the OneNote content.

OneNote has a rich set of APIs, as does WordPress.  I think it may be time to take a look and see what can be done to push instead of pull this content.

Microsoft HoloLens

One of the activities I anticipated in coming out to Build 2015 was experiencing the HoloLens.  I saw the announcement in January and watched the related video a number of times leading up to Build.  Of course the hope was to have this as the developer ‘give-away’ which would be incredible and allow us to build for the device.  And yes, as Alex stated during the keynote that “I have hundreds of these devices”, me and those around me grew very excited at what that might mean.  Then the realization set in that hundreds would not be enough for all given the thousands of us here.  Alex’s plan for these hundreds of devices was to provide sessions where attendees could review the devices in a couple of scenarios.  I chose the Hands-on Developer option and within a couple of hours received an email with my acceptance into the Holographic Academy. 

Development Experience

The development experience was a full 4.5 hours immersion into the world of Holographic development.  I had my own workstation and HoloLens device attached by USB.  The session followed a script designed to get you comfortable with both the tools and the device.  After a short sample app to get used to the HoloLens, we moved on to recreating the ‘Origami’ app.  The development takes place equally in Unity and Visual Studio. 

Unity is a development tool very popular in game development.  It provides a 3D area for placing objects, lights, camera and defining the various actions for these items.  The assets we needed for our application were provided in our workstations and it was a matter of placing them in the correct location in the object tree.  This part reminded me a little of xaml development in Blend.  Actions for the objects were defined by creating C# classes and dragging them onto the object. 

The C# code is modified using Visual Studio.  The code is there to look for events or periodically get the state of the HoloLens view, which reminds me of game or XNA development.  See if my world has change and do something in response to that change.  The lab provided the code to include the classes so we could spend time seeing the implementation in the device.  However, there was flexibility in how we coded certain components, especially in the voice recognition.  The lab code included standard phrases.  However, we were encouraged to include our own text and make it respond to that.  This worked quite well without any ‘voice training’ for the device and with other people around interacting with their own devices.

After the objects are bound and the code modified, the Unity application builds a Visual Studio solution and places it in a folder via a custom add-in to Unity, which is not publically available at this time.  The solution is opened in Visual Studio and the application deployed to the USB connected HoloLens device.  It is important the HoloLens is held while the application is launched so that it points to the location where it will be used as the code specified placing the object x number of inches in front of the device.  Once deployed, the USB can be removed.  Now untethered, you can view the app in 3D while walking around as well as closer and farther away.  This type of movement around the visual is accentuated by the spatial sound enabled in the device making the experience more realistic without any of the nausea/motion sickness sometimes experienced in other devices.  I was also able to see and carry on conversation with members of the HoloLens Team present in the room. 

The development experience was simplified for this short session, but I think this was enough to get a sense of the techniques needed to make this work.  I am guessing that this type of development is only needed for the immersive, 3D applications.  Universal Applications, which are also Holographic Applications, would just be created in the current development model in Visual Studio.  I would also think that these would appear for placement from some kind of app store interface instead of the deployment scenario described here.  This also gets into the question of the storage capabilities of the device which we did not discuss.  I look forward to getting my hands on a device and seeing what it can do without a script.

OneDrive for Business Development

April was OneDrive for Business month at TriState SharePoint.  ODFB or OD4B, depending on your preference, is the corporate user’s, cloud storage solution available as part of Office 365 SharePoint (Sites) or as a stand-alone product.  This is not to be confused with the OneDrive Personal you get as part of your Microsoft Account. 

For my part of the discussion, I focused on the development hooks available for ODFB.  This blog post describes the information presented in the meeting  I pulled this information from available resources on MSDN, dev.office.com, and Microsoft Virtual Academy.  I link to these sources in the content of the blog and don’t repeat the specifics here.  You can check out the links for the greater details.

I grouped these into 3 possible options, Provision, Customize, Develop.

Provision

Much like a MySite in SharePoint, ODFB is not created by default.  It is only instantiated when a user navigates to the site for the first time.  This can cause a slight delay while it is being created.  In one-off situations, the wait is not terrible.  If you are launch a new site to you user community, you may want to create those sites ahead of time and save unnecessary calls to the service desk.  Scripts are available in CSOM and PowerShell.  Both languages follow the same pattern. 

  • Connect to the SharePoint instance.
  • Get a collection of users
  • Connect to the User Profile object
  • Create ODFB instance. The collection of users should be less than 200 per batch.  There is a TechNet article describing the full process with the PowerShell code..

Customize

What is the first thing everyone wants to do with their SharePoint environments?  Make them not look like SharePoint.. While you can change the masterpage, this is not the recommended practice.  However, there are ways to change the appearance and content of the ODFB site.

First, why would you want to do this?  You may want to change the colors used on the ODFB site.  Maybe add a background image or do other things that make the ODFB site look more like the rest of your custom tenant sites.  All of this is possible with the patterns described here.  One other reason is for governance.  There may be content you want to make sure is included with each ODFB site.  This could be Sales Contract templates for the Field Sales Team or just standard policy documentation.  These patterns can also be used to check and confirm that the content remains included on the user’s ODFB site.

There are three design patterns available for enabling these changes.  They are App Part Model, Scheduled Job Model and the Pre-create Model.  All of these patterns are described in more detail in this post.  I’ll briefly summarize here.

App Part Model

You cannot deploy applications directly into the ODFB site like you can on a team site.  One method of getting around this is to create an app part that sits on an Office 365 page that is common to your users, like the home page of your intranet site.  When the home page loads, the app part runs and calls a provider hosted app so it can create an entry in a queue for the user with the information needing to change on the ODFB site.  A scheduled job looks at the queue and checks for work and performs the customizations described in the entry.  This model is needed as the process can be long running and would not be a good idea to run in the provider hosted app directly.  There is a great solution included in the Patterns and Practices repository on the OfficeDev GitHub.  It is complex, as it is a complete solution included console apps to apply and reset the customizations.  There is also a channel 9 video walking through the project.

Scheduled Job

A scheduled job is nothing more than some code, usually an executable, like a console application, that gets executed on a recurring basis by some process.  In SharePoint, these would be Timer Jobs, which we are not available in Office 365.  As a an IT Pro, you might think of these as Windows Scheduler Jobs that run on a server.  In Azure, the equivalent is a WebJob.  The webjob runs within an Azure website and will run an executable on a defined interval.  Regardless of how you architect it, the executable portion of the scheduled job runs code that queries Office 365 for new ODFB sites.  When it finds them, it applies the customizations defined in the code.  The potential limitation with this approach is that people may get to the site prior to the customization being applied as search does take time to populate with the new sites. 

Pre-create Model

I mentioned the provisioning options available in the first part of this post.  It is possible to include the code for customizing the ODFB site at the time it is created.  This provides a simple way of getting the sites and the customizations applied from the start.  Unlike the other two models, creating site for additional users and resetting user changes is not easily handled in this model.

Develop

In October 2014, the Office Dev Team RTMd the Office 365 APIs.  These APIs were designed to make the consumption of Office 365 services easy for the developer and to make them available on every major development platform, including iOS, Android and PHP.  If you are interested in this type of development, start by going to dev.office.com.  It has all the links for training, code samples and the tool I showed at the end of my talk, API Sandbox.  This site offers an easy way to try out getting data from any of the services exposed directly through the APIs, Calendar, Mail, Contacts and Files.  There are samples are client library and REST samples written in both C# and JavaScript.

As for the actual project sample, I stepped through lab project associated with the Microsoft Virtual Academy course, Deep Dive: Integrate Office 365 APIs in Your Web Apps.  Section 3 focuses on ODFB integration and includes a lab in which you build a web site that includes a page showing the file in the user’s ODFB.  The code for this lab is available here.  If you clone this repo, move the project to a local folder and open it from there.  The folder names are too long in the repo and they prevent Nuget from updating the packages.  Even with that move, I still had issues with the OWIN package.  I had to remove it and it’s dependencies using uninstall-package command and then reinstall again.  This was a little troubling but it did solve my build issues.

That’s all for the recap.  Ping me on twitter or leave a comment if you have any questions.

Office 365 for Developers – Philly .net Code Camp Session

In 2014, we tried some thing a little different with Philly .net Code Camp, offering a 2-day camp at Valley Forge Conventions Center.  It was fun.  We learned a lot about running an event of that size.   

This year for our 21st Code Camp on March 20 & 21, we have something old and something new. 

For the old, we are back at the Microsoft offices in Malvern.  This goes back to before I started attending Code Camp, which was when they were at DeVry.  Same building except the Microsoft Technology Center is now there and the rooms all have top notch presentation equipment.  We still have 60 sessions on Saturday over 12 different tracks with more than 50 speakers, some local, some from out of town, but all delivering great content.

For the new, we are conducting full day learning sessions.  There are 10 sessions to choose from and while we ask for a selection when you register, you can still change as long as there is room.  You can see the full list of course and the rest of the information on the Philly .net site.  There are additional items for attendees including a guaranteed spot at Code Camp, which typically reaches capacity quickly.  Registration for these learning sessions is open if you are interested.

I am participating in this longer format and conducting a full day session on Office 365 for Developers.  Office 365 has a ton of great services available and many of them provide access via a rich set of APIs (and if they don’t now, I expect they soon will).  Office 365 also represents a departure in how you typically architect solutions, especially for those coming from the ‘full-trust’ SharePoint development world.  This session will give you everything you need to begin writing your own solutions against Office 365 services.

Here is the agenda for the day. 

  • Introduction to Office 365
  • Setting up the Development Environment
    • Development Guidelines for Office 365
    • Branding and Customizations – Code
    • Office 365 APIs – the new Application Model – Lots of code
    • Staying Up to Date and Wrap up
    I am currently not planning for this to be a hands on lab.  However, you will be able to follow along as i walk through the steps, so bring your laptops. 
    For those planning to attend or interested in attending, let me know if this is what you expect.  If you are interested in a topic not mentioned here, add a comment or tweet me.  Same for the agenda.  I expect this to be a small audience, so I can morph the content to focus on your interests. 

Looking forward to seeing you there!

Create your own website, free on WordPress.com.Create your own website.
Start free