Monthly Archives: September 2013

Super easy source control – Using Git and Dropbox together

I have been a big fan of Git source control for a while now.  It’s got great momentum, loads of support on various platforms and plenty of tools to help with using it.

For those not aware of Git i suggest taking a read of the Wikipedia article as i am not going to cover the basics of what a source control system is, or in Git’s case a distributed version control system.

I like Git … it is super simple. There is no server and no SQL database etc… Its all just on the file system.

As a Windows user I recommend the Git Extensions tools. It gives you a GUI tool that lets you do almost everything with your Git repository.

If you are working with someone else on some source there are a couple of strategies for using Git as i understand things (please let me know if there are other better options)

  1. Create Patches and send those to others (say in an email)
  2. Create a central repository and Push/Pull changes to that repo that everyone has access to.

GitHub.com is an example of 2. above that a lot of people will recognize. Another, less well known option is Microsoft’s Team Foundation Service (TFS) Online.  Both allow you to create and interact with repositories remotely.  In a reasonably simple manner.  You have to pay for private repos on GitHub and TFS is free for up to 5 users currently with more pricing options coming soon.

1. above seems hard to me. Constantly managing patches etc… eeek

However, for two or three person projects I wanted an even simpler option, so i started looking at using Dropbox to host the central repo. The idea is that team members push/pull from a repo that is in a Dropbox folder and that is replicated between machines. This means no additional setup to do with authentication with those services which i think makes life easier.

There is a drawback that you need to be aware of!  You really want to avoid people pushing changes to the central repo at the same time. This can lead to Dropbox getting confused and corrupting the repo. However, if you IM people and make sure it’s all clear then you should be good to go.  This is really only suitable for a two or three person team. Get a GitHub account if you need something more robust 🙂

Here is how it looks:

image

The central repo doesn’t have a “working directory” (a copy of the source that you can work on). It’s just the Git repo.  You can’t edit files etc… in this location. The Central repo is synced between, in this case, two peoples machines (there is also a copy in the Dropbox cloud).

Each person “clones” the central repo to a local working location on their machine. They do this as a personal repo so that they get a working directory. This will allow them to edit and modify files etc… They can also “commit” (aka checkin) changes to their personal repo.

When they are ready they Push commits from their personal repo to the central repo.  This then replicates the changes to others.

This might sound complex, but if you are a Git user and familiar with the tools its pretty easy to set up.

Using Git Extensions you do this as follows:

First create a new Dropbox folder:

image

Open Git Extensions and create a new central repo like this in your new folder in Dropbox:

image

Now go and create your personal Local repo by cloneing the central repo … but do it to a local directory (non-Dropbox)

image

Then you can open your Local repo and work your coding monkey magic in there. Drop in a file for example (note the irony of the filename i am using here and the file extension … i don’t like JS).

image

Commit that sucker and you have made your first legit change to the code.

At this point your buddy cant see your stuff. You have been working locally.  So now you need to Push your commit to the central repo.

image

Notice that your central repo is already set up as the “origin” remote location.  Push to that and you will notice some files start syncing in Dropbox.

image

Now your central repo is all syncing and dancing your counterpart can join the Dropbox folder and do the same “clone” process you did to create a local repo that they can work in.

I got the idea for using this method a while back from this stackoverflow thread: http://stackoverflow.com/a/1961515/26843  It shows you how to do this same process via the Git command line.

-CJ

SharePoint Saturday Redmond – Building solutions with the future in mind

I had a great time presenting at the SharePoint Saturday Redmond event today at the Microsoft Conference Center in Redmond.

My session was aimed at asking people to think about building and architecting solutions today while keeping the future in mind … even if you don’t have any plans to move to the cloud in the near future.

Even if you are not building cloud apps or solutions today this is still relevant. Get code out of your SharePoint processes and into a loosely coupled architecture. Your servers will be safer, faster and will remain up more often.

Here are the slides.

Erica Toelle was kind enough to take some notes during the session: http://ericatoelle.com/2013/spsred-johnson/

Launching SharePoint Apps, launch sequence, debugging and AppRedirect.aspx

Writing SharePoint Apps can be tricky at times. Especially until you learn to know where to look when things are not working for you. Usually the first issue people strike is trying to launch their app and it not working.

Usually one of the first errors people strike is a common one that has an error that says “The parameter ‘token’ cannot be null or empty string”.

image

This is a signal that something went wrong launching the application and that some of the information that is passed to SharePoint during the app launch wasn’t passed correctly.  Usually due to an app setup issue.

The particular error above could be caused by a variety of issues, however the point of this post is to show you the first place I look when trying to debug it.  Hopefully this will help others find and fix their problem too.

First, to understand where to look when debugging its important to understand the process of what happens when you are launching a SharePoint App. The basic steps of the launch process are:

  1. User clicks the app to launch it
  2. SharePoint sends the user to the AppRedirect.aspx telling it what app to launch
  3. AppRedirect.aspx builds a set of launch parameters including a context token and other parameters about the SharePoint site launching the app e.g. SPSiteUrl
  4. AppRedirect.aspx renders a page with these parameters as a hidden HTML form on the page
  5. Javascript runs that submits the form to the applications launch page, POSTing these form parameters along with some query string parameters
  6. The App page is called and can get these parameters from the Request and use them as it needs. e.g. for using the CSOM to call back to SharePoint.

The error shown above is a snippet of boilerplate code from a provider hosted app code template in Visual Studio.  In order to construct the CSOM context the classes in TokenHelper.cs that are used need some of the information passed in the POST parameters from AppRedirect.aspx.  These are not on the query string as they are POST parameters, so this is usually where people get stuck debugging.  You need to use a tool like Fiddler to see the POST being made and take a look at it.

Below is what the launch sequence looks like in Fiddler (click on the image to get a bigger version):

image

  1. AppRedirect.aspx is called and the launch parameters are constructed and the Form is submitted by the browser.
  2. The app page is called, in this case Default.aspx
  3. My app wants to make a call using the CSOM to SharePiont and as part of that needs an OAuth Access Token, so is reuqesting one from Azure Access Control Services (ACS) (topic for another post).
  4. Finally the CSOM query is processed and the call to ProcessQuery is made.

In the browser you will recognize the AppRedirect.aspx page by the infamous “Working on it…” text 🙂

If you open #1 above in Fiddler in the raw response to the browser you will see the following:

image

This is the HTML Form with the launch parameters included. 

If the SPAppToken is empty … you have a launch problem 🙂

If your form is missing the SPAppToken then you will get the error message at the beginning of those post. It’s got the context token that you need in order to use the CSOM.

If it’s empty in the Form you likely have an error message in the SPErrorInfo giving your some more information about why is null/empty.

SPErrorInfo is your first place to start looking for why things are not working.

This should provide some insight and more pointers on where to look next.

E.g. “The Azure Access Control service is unavailable”.   This message says that SharePoint can’t construct the SPAppToken because it cant talk to ACS in order to do that.  This could be for a variety of reasons, such as network connectivity.

This post wasn’t written to solve every problem you have with launching an app.  It was posted to help those trying to debug their apps.  I thought it would be useful for those wanting tips on where to look to find some information when they are having issues launching their app.

I hope to helps!

-CJ

Yammer and Office 365 integration gets tighter

Microsoft has been talking about faster releases in Office 365 and getting functionality out to its customers on a cadence they are not used to with on-prem software.  It’s great to see this happening albeit too slowly for some people.

Today is another example of small but important steps forward.

Christophe from the SharePoint team just posted about a new improvement in Office 365 that lets you comment on a document that lives in Office 365 and have that comment land in Yammer.

We had built an app called Share-It for Office 365 that does this, albeit in a less sophisticated manner.  You can read about that here: http://www.looselytyped.net/2013/06/26/shareit-for-office-365-is-published/

Although I’m sad that Share-It for Office 365 in its current form has been superseded we have some new plans for Share-It that I hope to be able to talk about shortly deepening the integration options between the two system.  I can’t say i am upset they did this at all, after all the idea from Share-It actually came from the work I did with the SharePoint team during the last SharePoint Conference and it was very clear that eventually this same functionality would be baked in. It was no surprise at all.

It’s awesome to see the two getting small but important improvements like this!  Well done MS.

Read Christophe’s post here:
http://blogs.office.com/b/office365tech/archive/2013/09/12/starting-yammer-conversations-from-documents-stored-in-sharepoint-online.aspx

-CJ.

Extending your Azure AD tenant to include Office 365 services

I learnt something today that I thought would be interesting to share in the hope someone else won’t need to do the research.

Say you already have Windows Intune or Azure AD already up and running and now you are ready to give Office 365 a go.

You have a couple of choices:

  1. Create a new Office 365 tenant
  2. Extend your existing Azure AD tenant and add Office 365 services.

The correct way to do things is to Extend your existing tenant and add Office 365 services.  If you have Azure AD already you are likely DirSync to push all your user accounts from your on-prem AD to Azure AD.  It makes sense that those are the same users you want to access Office 365 no doubt.

If you try and create a new tenant and then do DirSync to that tenant you will most likely hit issues with trying to push the same users to two different Azure AD tenants.

Extending is the way to go.

If you sign into the Office 365 management portal using your current credentials you use for Azure AD/Intune you will see a page like this:

image

You will notice it is saying that you are not currently subscribed to any Office 365 services.

So how do you go about adding those?

Jump over to the “purchase services” tab in the left navigation and you will get a selection of the various plans (aka SKUs) available.  In my case I picked the E3 –Trial.

image

This will then add the services included to your tenant. Once provisioning is complete you can carry on with the other tasks you might like to do like setting up Identity Federation (ADFS) etc…

It seems blatantly obvious now I have tried this and this is possibly hardly worth a blog post, but until now I had always started from the Office 365 side of things and had never looked at starting with Azure AD and adding Office 365.

Turns out to be dead simple 🙂

-Chris.

Moving house on the internet and SEO

When I left Microsoft a couple of years back I also decided to move house on the internet. I started looselytyped.net and made it my new location on the tubez (aka the internet).  I didn’t technical “move” house I guess as you can still find my old blog.

In fact that is the problem!

If you search for “Chris Johnson SharePoint” my new site is on the first page of Bing, but not at the top & it’s the 2nd result on Google.  However, my old blog is in the #1 spot in both search engines. Grrrr.

I didn’t want to delete my old blog, that seems like overkill and old posts still get a lot of traffic. There are 3 or 4 old posts that are knocking past 150,000 views which must mean someone finds them helpful. But given I have moved house I want people to find me at my new location. This issue has been confirmed by a couple of others who tried to find me and didn’t have good success.  Classic SEO problem some would say.

Unfortunately, I cant seem to “relocate” my old content to my new blog & put in a good redirection process that would be search engine friendly. My old blog is hosted with Microsoft and there are limited controls as far as I can tell.  So I think leaving it in place is my only option.

I have been making a concerted effort to try and get my new location indexed and ranking higher so people can find me. It has been working slowly.

One tool I heard about in the Startups for the Rest of us podcast was HitTail. (www.HitTail.com).  I also saw that Andrew Connell was giving it a try too, so thought I would give it a shot.

It’s a very nifty tool.  You sign up (free trial) and then add a wee bit of JavaScript to your page and you are all set. 

What does HitTail do?

In a nutshell HitTail shows you what keywords (from your existing organic search traffic) you should target when writing content for your site that will increase your ranking.

Now this seems a bit counter intuitive at first, at least it did to me. Why would I write more content about things people are already coming to my site for that they found from a search? 

Well, the suggestions it makes are based on the fact that people are finding your site but that you could be doing a much better job of ranking higher for those terms. So it helps guide you on what to write about that will bump you up the ranking.

So I am trying it out.  I am reviewing the suggestions it makes and matching that up with topics I a) want to write about, b) have something useful to say about, and c) that I know people will find interesting.

At this stage it’s a trial to see how useful I find the suggestions, but I thought it was a handy tool to help with my internet home relocation.

If any of my readers are SEO experts I would love any other suggestions you have around my predicament.  Suggestions welcome! Get in touch on Twitter @LoungeFlyZ

-CJ