Answered: Leave request for SharePoint Office 365 Sample on MSDN 5


So, I as a cure for insomnia, decided to troll the CODE.MSDN site for SharePoint Office 365 questions that interested me.  I found this request and figured it was something i could knock out, so i did. There was not much to go on interms of HARD requirements so i posed a question, I assumed if Im up and about, the person making the request must be up too 🙂 but alas no. So, i went ahead and did the sample as I would envision it. In fact, internally at work, we have something On Prem that is similar so this actually made it more appealing.

I can and will make this example more robust and may submit it up on the MarketPlace, I dont know, just to say that I have, but it seems something that Im sure must already be there, Ill just endeavor to make mine better 🙂



As this is an Office 365 SharePoint Online example, you basically don’t need anything as you would for an On-Prem solution, all you need really is:

  • A Office 365 SharePoint Online Site to build against
  • Visual Studio [for completeness I am using 2013 but others will do]
  • Your Brain & some Idle time

What this example will set out to do in this version is the following

  1. Permit an End User to Request Leave off Work/ Holiday/ Vacation etc.
  2. Send a Request for Approval to the End Users Manager/ or the person On Behalf Of
  3. Permit the Approver to Adjudicate the request in an Approval Workflow in SharePoint 2013
  4. Send a ‘Contract of Sorts” to the Requester alerting them of the decision for their acknowledgement
    1. Notification includes a process to Accept the decision or Appeal it
  5. If Approved, update a Leave/Out of Office (OOF) Calendar with the relevant information to show the person being OOF

I plan to extend this example later on to flesh out the Appeals Process, make pretty App Icon and put some more bells and whistles on it. Sexy it up so to speak 🙂


As with all my work when I set out to do a SharePoint project that involves List/Libraries, Content Types, Workflows/Event Receivers, etc, I often will create my own Site Columns, Content Types, List Definition and Instance (see post here on how to do that). Once I complete that process I typically will Branch my Project (in TFS Online) and start to Dev out the Unit of work/ Story (Agile).  I created a branch for Workflows and set up folders for what I will build out now and later on


This is what my Visual Studio Solution looks like now


So, with that heavy lifting complete, lets focus on the Workflow.

Workflow Build out

First, you add a Workflow to your project and associate it with your List, in my case I am associating it with the “TimeOffRequest” list instance. I also set the Workflow to Start on “On Item Created” and have New Task List and Workflow History List created. Basically this…


Once you do that, you will get a few assets created for you

  • The Workflow itself
  • A History List
  • A Task List


The canvas will open up and you will a blank slate with one Sequence added. What I typically do here and I learned this from Andrew Connell in all his Demos/ Preso is to change that Default Sequence to “Root” and then embed your other abstracted logic flow buckets inside that sequences as nested Sequences.  I do this for the following reason

  1. It makes the code much more readable and manageable
  2. It allows you to scope your Variables etc to its own sequence
  3. Helps me troubleshoot if/when I get issues

So mine looks like this now


and you can drill down into each section like so



Manager Approval





Update Time Off Calendar


Other Important items not so obvious

So, there are variables that are crated along the way either by an objects Return Type or Auto Loaded by Variable Declaration in SPLookupItem Object, etc

For example here is what is in scope for “Root” Sequence


here is what is inscope for “Notification”


How it Works

So, when you get everything working you publish it to your Office 365 SharePoint Tennant. Were I paid for this I would mock up the Default.aspx page to show links for the Time Off Request and the Calendar with an Appropriate View, but for now we will just use Different Tabs in the Browser

You will have a new App in your Site Contents like so


Here are the Tabs

First the TimeOffRequest


Second the TimeOffCalendar


Dev Testing

Lets put it through the paces now.


Now lets submit this Form

Now we have a form submitted


lets check the Status of the Workflow, and we can see below we have one already going


We even got an email in Outlook. for now, lets adjudicate this as Approved so it will appear in the calendar eventually


Here you can see that we have buttons to Approve and Reject and we have meaningful information in the Email Body. Finally you can see that the Workflow is running in the Context of the App Principal at the bottom, look to the left of the buttons.

Next, and just showing the Task and History Log we can see now that a Contract has been sent back to the Requestor after the decision has been made


lets go ahead and do that, this time I wont do a screen shot as its similar to the same Approve Reject one earlier.


Finally you can see everything done, and the only thing we need to do is check the Calendar to see if the Item has been added.


and sure enough it is….


So, i hope this was helpful, if so, drop me a comment, share this online, etc.. hook a brotha up 🙂

Leave a comment

Your email address will not be published. Required fields are marked *

5 thoughts on “Answered: Leave request for SharePoint Office 365 Sample on MSDN

  • Alex Lupu

    Hi Fabian,

    I deployed the solution on a SP Online site collection (Development template), but when I access the app it only shows a title “Page Title” and a “Hello ” message in the page.

    Can you please advise to make the solution work for me.

    Best Regards,
    Alex Lupu

    • fwadmin Post author

      SP App Solutions by default will take you to a page.asmx, that is how it is configured. You can either embed a link on that page or use the config file in your solution to point it to a list/library of your own choosing.

  • Crizz T

    this is very helpful,
    What about keep tracking the days automatically it the way that you set a number of days, for example 25 per year, and having some lists on SharePoint where you can see exactly how many day left for the employees ? once one workflow is finish and the employee requested 3 days and has been approved on the status list to appear that this employee has 22 days left.
    Thanks, very much.

  • Snehal H Rana


    Great tutorial and example. I have a quick question on this approach. Is there any ways to publish the vacation days to a public folder calendar on Exchange 2010? If so what is the approach?


    • fwadmin Post author

      2010 huh? i am not sure b/c i don’t know about access and access control. but if you are doing this in .NET then all you need to do is bring in the assembly for Exchange and code against it within the same transaction. not sure if there is a REST API you can call.