• Home
  • About the Author
  • Disclosure Policy
KEEP IN TOUCH

Outlook 2013 and Visual Studio 2012: Getting started for VSTO developers

Mar28
2013
Leave a Comment Written by Pieter van der Westhuizen

In my last article we took a whirlwind trip through the process of starting a new Add-in Express Office add-in from a VSTO developer’s point of view.

Today we’ll focus on how developers, coming from a Visual Studio Tools for Office (VSTO) background, can get started developing add-ins for Outlook 2013 using Add-in Express and Visual Studio 2012 (C#, VB.NET or C++.NET).

Read more at Add-in Express.

To see all my recent Add-in Express blog posts visit my author page.

Share this:

  • Twitter
  • Google +1
  • Facebook
  • LinkedIn
  • Reddit
  • Digg
  • Send to Kindle
Posted in Add-in Express - Tagged Ms Outlook

Office 2013 and Visual Studio 2012: Getting started for VSTO developers

Mar18
2013
Leave a Comment Written by Pieter van der Westhuizen

So you’ve been using Visual Studio Tools for Office (VSTO) for some time now and luckily you’ve discovered a better and easier way to develop Office add-ins, namely Add-in Express. You’ve already spoken to our friendly sales staff and bought your own license of Add-in Express.

Ready to start a new happier life of creating awesome Office Outlook extensions you excitedly fire up Visual Studio and hit File, New Project.

Read more at Add-in Express.

To see all my recent Add-in Express blog posts visit my author page.

Share this:

  • Twitter
  • Google +1
  • Facebook
  • LinkedIn
  • Reddit
  • Digg
  • Send to Kindle
Posted in Add-in Express - Tagged Add-in Express

Excel 2013 single document interface (SDI): How to rebuild your task panes to support it

Feb28
2013
Leave a Comment Written by Pieter van der Westhuizen

If you’re an avid user of Excel, you would’ve noticed that Excel 2013 has moved from being a Multi document interface (MDI) application to being a Single document interface (SDI) application.

Essentially what this means is that one Excel window holds one Excel workbook, whereas in the past you could have multiple Excel workbooks open in one Excel window.

Read more at Add-in Express.

To see all my recent Add-in Express blog posts visit my author page.

Share this:

  • Twitter
  • Google +1
  • Facebook
  • LinkedIn
  • Reddit
  • Digg
  • Send to Kindle
Posted in Add-in Express, MS Office - Tagged Add-in Express, MS Excel

Converting a .vdproj to WiX in Visual Studio 2012, 2010, 2008

Feb19
2013
Leave a Comment Written by Pieter van der Westhuizen

I’m sure you’re all aware of the fact that, from Visual Studio 2012, that Visual Studio Setup projects (.vdproj) is a thing of the past. This news has been met with shock, horror and disappointment, but luckily all is not lost.

As I’ve mentioned in a previous article Creating a WiX setup project on Visual Studio 2012, Microsoft is touting WiX (Windows Installer XML) as the heir apparent to the traditional VS Setup projects and all things considered it is a very good and free alternative.

The problem, however, is when you’ve already invested a great deal of time and energy in creating a .vdproj installer for you application, the prospect of having to re-create it using WiX is not a welcome one.

Read more at Add-in Express.

To see all my recent Add-in Express blog posts visit my author page.

Share this:

  • Twitter
  • Google +1
  • Facebook
  • LinkedIn
  • Reddit
  • Digg
  • Send to Kindle
Posted in Add-in Express, WiX - Tagged Add-in Express, WiX

How to dynamically bind Outlook add-in UI elements to the context

Jan29
2013
Leave a Comment Written by Pieter van der Westhuizen

Something that I’ve noticed is that if you want to really start bending Microsoft Outlook to your programming will, you need to start embracing and combining the use of message classes and content types when developing Outlook add-ins.

If you’ve been using Add-in Express for a while or have read through our website and relevant blogs in the past, you’ll surely know that Add-in Express has a very useful feature we call Outlook Context Sensitivity. This allows you to display (or hide) your own custom UI elements as well as a certain number of the built-in Outlook UI elements.

In this article we’ll dive into some real-world examples and I’ll show you how to truly integrate your solutions into Microsoft Office using Add-in Express for Office and .net.

Read more at Add-in Express.

To see all my recent Add-in Express blog posts visit my author page.

Share this:

  • Twitter
  • Google +1
  • Facebook
  • LinkedIn
  • Reddit
  • Digg
  • Send to Kindle
Posted in Add-in Express - Tagged Add-in Express, Ms Outlook

Creating custom Outlook forms: Outlook 2010 and 2013 form examples

Jan21
2013
Leave a Comment Written by Pieter van der Westhuizen

If you’ve read through our website content, you would probably have read that Outlook is one of the most featured Microsoft Office applications supported by Add-in Express. Microsoft Outlook is also one of the most popular desktop e-mail clients, so it makes sense as a developer to leverage that popularity and to extend Outlook with your own functionality.

Read more at Add-in Express.

To see all my most recent Add-in Express blog posts visit my author page.

Share this:

  • Twitter
  • Google +1
  • Facebook
  • LinkedIn
  • Reddit
  • Digg
  • Send to Kindle
Posted in Add-in Express - Tagged Add-in Express, Ms Outlook

Deliver personalized, proactive, website content using TrackToAct

Jan14
2013
1 Comment Written by Pieter van der Westhuizen

It’s been a while since I wrote about TrackToAct and they have certainly been busy! I’ve recently taken a closer look at the ability TrackToAct provides to send my users real-time and personalized messages when they visit my product website.

I’ve already shown you how TrackToAct gathers usage analytics and how you can view this information in your TrackToAct account’s Event Stream, but today I want to show you how you can start to respond to those events by actually sending your users personalized messages.

Setting up the website

Before you can send messages to users on your website via TrackToAct, you need to add the TrackToAct JavaScript snippet to every page you want to instrument. You can find your own personalized version of the JavaScript snippet in your TrackToAct account under Software Config > Event Sensor.

Image1

You can choose the Tracking Type to be either Synchronous or Asynchronous, the latter being a good idea if you need faster load times. You also have the option to check the “Automatically track page loads” checkbox. This will add a small piece of JavaScript that will automatically log an event each time a page is loaded:

  <script type='text/javascript' language='javascript'>
    trackToAct.logEvent('pageload', document['title']);
  </script>

All you need to do next is to copy and paste the snippet into all the pages of your website. In my case I’m running an ASP.Net MVC website, so all I needed to do to instrumentize my entire site was to add the snippet to my _Layout.cshtml file.

Setting up the notification type

TrackToAct supports the following three notification UI types:

  • Top Bar;
  • Inline; and
  • Modal.

To set this up, navigate to Software Config > Messaging UX and select your preferred notification type in the dropdown box.

Image2

Viewing the live sessions

With your website updated and active, you can log into your TrackToAct account and navigate to Action > Event Stream. You’ll notice that (a) I’ve already given the one visitor to my site an unique name; and (b) that TrackToAct has generated an unique @t2amail.com e-mail address for the visitor.

Image3

I can now use any e-mail client to send that specific customer a message in real-time whilst they are visiting my site.

Sending real-time content

In Microsoft Outlook I’ve drafted a number of pre-designed e-mail messages for the purpose of engaging visitors on my site. Custom Outlook stationary is ideally suited for this. All I need to do is create a new e-mail in Outlook and send it to the unique e-mail address mentioned earlier.

Image4

You can also, instead of plain email, choose to use your own CRM (Infusionsoft) or marketing automation tool to send personalized content by turning on the email auto response when TrackToAct triggers a CRM update based on user activity on your website on in your app.

Real-time content on your website

Whilst the user is busy browsing my website, they will receive a modal dialog that display the e-mail message’s body content. You can control who sees what and how they see personalized content.

Image5

TrackToAct enables you to identify trends in the usage patterns of your users and website visitors. For example, if you see that a specific visitor visits a specific knowledge base article or blog post, you can engage them with an in-app message investigating whether they would like to see a video or read more information on a related topic.

By using TrackToAct’s messaging to deliver personalized content you can keep your visitors interested, engaged and guide them towards the content and information they’re looking for.

Why not sign up and try it for yourself!

 

This was a paid-for article brought to you by TrackToAct. For more information and complete disclosure, please see this blog’s disclosure policy.

Share this:

  • Twitter
  • Google +1
  • Facebook
  • LinkedIn
  • Reddit
  • Digg
  • Send to Kindle
Posted in TrackToAct - Tagged In-app Analytics, TrackToAct

Creating a South African ID Number custom validation attribute for ASP.Net MVC

Jan08
2013
1 Comment Written by Pieter van der Westhuizen

ASP.Net MVC gives you the option to create your own custom validation attributes in order to validate your models. I’ve recently needed such a validation attribute in order to check whether a valid South African ID Number was entered in a web form.

I’ve stumbled upon a nice C# implementation of this article by Donovan Olivier, in order to validate a South African ID Number and return information such as gender and whether the person is a South African citizen. I’ve changed his code a little bit by adding extra functionality to get the person’s age.

The Basics

First, let’s create the classes we require, the first is the IdentityInfo class, that is used to validate the ID Number.

IdentityInfo.cs

    public class IdentityInfo
    {
        public IdentityInfo(string identityNumber)
        {
            this.Initialize(identityNumber);
        }

        public string IdentityNumber { get; private set; }

        public DateTime BirthDate { get; private set; }

        public String Gender { get; private set; }

        public int Age { get; private set; }

        public string AgeToLongString { get; private set; }

        public bool IsSouthAfrican { get; private set; }

        public bool IsValid { get; private set; }

        private void Initialize(string identityNumber)
        {
            this.IdentityNumber = (identityNumber ?? string.Empty).Replace(" ", "");
            if (this.IdentityNumber.Length == 13)
            {
                var digits = new int[13];
                for (int i = 0; i < 13; i++)
                {
                    digits[i] = int.Parse(this.IdentityNumber.Substring(i, 1));
                }
                int control1 = digits.Where((v, i) => i % 2 == 0 && i < 12).Sum();
                string second = string.Empty;
                digits.Where((v, i) => i % 2 != 0 && i < 12).ToList().ForEach(v =>
                                                                 second += v.ToString());
                var string2 = (int.Parse(second) * 2).ToString();
                int control2 = 0;
                for (int i = 0; i < string2.Length; i++)
                {
                    control2 += int.Parse(string2.Substring(i, 1));
                }
                var control = (10 - ((control1 + control2) % 10)) % 10;
                if (digits[12] == control)
                {
                    this.BirthDate = DateTime.ParseExact(this.IdentityNumber
                                                       .Substring(0, 6), "yyMMdd", null);
                    this.Gender = digits[6] < 5 ? "Female" : "Male";
                    this.IsSouthAfrican = digits[10] == 0;
                    this.Age = CalculateAge(BirthDate);
                    this.AgeToLongString = CalculateAgeToLongString(BirthDate);
                    this.IsValid = true;
                }
            }
        }

        private int CalculateAge(DateTime birthDay)
        {
            DateTime today = DateTime.Today;
            int age = today.Year - birthDay.Year;
            if (birthDay > today.AddYears(-age)) age--;

            return age;
        }

        private string CalculateAgeToLongString(DateTime birthDay)
        {
            TimeSpan difference = DateTime.Now.Subtract(birthDay);
            DateTime currentAge = DateTime.MinValue + difference;
            int years = currentAge.Year - 1;
            int months = currentAge.Month - 1;
            int days = currentAge.Day - 1;

            return String.Format("{0} years, {1} months and {2} days.", years, months, days);
        }

Add a new class to your project, and make sure it derives from ValidationAttribute class. We only need to override two methods for this to work.

RSAIDNumberAttribute.cs

    public class RSAIDNumber : ValidationAttribute
    {
        public RSAIDNumber()
            : base("{0} is not a valid South African ID Number")
        {

        }

        public override string FormatErrorMessage(string name)
        {
            return String.Format(ErrorMessageString, name);
        }

        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            IdentityInfo idInfo = new IdentityInfo(value.ToString());

            if (!idInfo.IsValid)                
                return new ValidationResult(FormatErrorMessage(validationContext.DisplayName));

            return null;
        }
    }

You’ll notice that we create a new instance of the IdentityInfo class and pass it the ID Number value. We then use the IsValid property to check if the user did indeed enter a valid South African ID Number.

Next, we need to create a model to validate. Decorate the RSAIDNumber field with the RSAIDNumber custom validation attribute we’ve created earlier:

ApplyModel.cs

public class ApplyModel
{
    [RSAIDNumber(ErrorMessage = "A valid RSA ID Number is required.")]
    public string RSAIDNumber { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
}

Client-side validation

At this point we have enough for the model to be able to validate the ID Number when the user submits the form i.e server side validation. But it would be much better if we could use client validation, so when the user enters a wrong ID in the field they immediately get a message informing them that the ID number is not valid – eliminating the need to submit the form first.

In order to use client-side validation make sure you set the ClientValidationEnabled and UnobtrusiveJavaScriptEnabled keys in the web.config file to true. These values should be true by default when creating a new MVC project.

  <appSettings>
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>
     
Step 1 – Enabling client validation on the validation attribute class

Before we can enable client-side validation for our custom validation attribute, we need to change it to implement the IClientValidatable interface.

    public class RSAIDNumber : ValidationAttribute, IClientValidatable

We then need to implement the GetClientValidationRules method. In this method we’ll create a new instance of a ModelClientValidationRule object and set its ErrorMessage as well as the ValidationType properties. The ValidationType property is important for later, when we build our own jQuery validation method.

        public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, 
            ControllerContext context)
        {
            ModelClientValidationRule rule = new ModelClientValidationRule();
            rule.ErrorMessage = FormatErrorMessage(metadata.GetDisplayName());
            rule.ValidationType = "rsaid";
            yield return rule;
        }
Step 2 – Create the jQuery validation method and adapter

Next, add a new JavaScript file to your project, and call it validations.js.

image

We’re using MVC 4 so, we need to add our validations.js file to our jqueryval bundle in the BundleConfig.cs class – It’s in the App_Start folder.

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.unobtrusive*",
                        "~/Scripts/jquery.validate*",
                        "~/Scripts/validations.js"));

Add the following to your validations.js file:

validations.js

// Validation Method
$.validator.addMethod("rsaid", function (value, element, param) {
    var idnumber = value;

    //1. numeric and 13 digits
    if (isNaN(idnumber) || (idnumber.length != 13)) {
        return false;
    }
    //2. first 6 numbers is a valid date
    var tempDate = new Date(idnumber.substring(0, 2), idnumber.substring(2, 4) - 1, idnumber.substring(4, 6));
    if (!((tempDate.getYear() == idnumber.substring(0, 2)) &&
        (tempDate.getMonth() == idnumber.substring(2, 4) - 1) &&
        (tempDate.getDate() == idnumber.substring(4, 6)))) {
        return false;
    }

    //3. luhn formula
    var tempTotal = 0; var checkSum = 0; var multiplier = 1;
    for (var i = 0; i < 13; ++i) {
        tempTotal = parseInt(idnumber.charAt(i)) * multiplier;
        if (tempTotal > 9) {
            tempTotal = parseInt(tempTotal.toString().charAt(0)) + parseInt(tempTotal.toString().charAt(1));
        }
        checkSum = checkSum + tempTotal;
        multiplier = (multiplier % 2 == 0) ? 1 : 2;
    }
    if ((checkSum % 10) == 0) {
        return true
    };
    return false;
});

// Validation Adapter
jQuery.validator.unobtrusive.adapters.addBool('rsaid');

In case you’re wondering; Yes, you’ll need to add the same type of logic you’ve used in C# to determine whether the ID is valid but in this case using JavaScript. I found the above JavaScript to validate a RSA ID on David Russell’s Blog

The validation adaptor is very easy in this example because we only need to know whether the validation result is True or False, so we register the validation method using the addBool method.

Adding the View

All that is left to do is add a view.

Image5

Check the Create a strongly-typed view checkbox and select the model in the combo box( Make sure you’ve compiled your project first!), also check the Reference script libraries checkbox – this will automatically include the jqueryval bundle in the view. Select Edit as the Scaffold template.

Image6

The code for your view should look like:

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Index</h2>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>ApplyModel</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.RSAIDNumber)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.RSAIDNumber)
            @Html.ValidationMessageFor(model => model.RSAIDNumber)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.FirstName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.FirstName)
            @Html.ValidationMessageFor(model => model.FirstName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.LastName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.LastName)
            @Html.ValidationMessageFor(model => model.LastName)
        </div>

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}

Notice the Scripts section in which the jqueryval bundle is rendered – Remember this bundle contains our validation.js file!

And if everything builds and runs, your page should look like this when the user types an incorrect South African ID Number:

image

Thank you for reading! I hope you can find this example useful for your own projects!

Download the sample C# project here.

PS: I’ve used ASP.Net MVC 4 for this example, but it should work equally well in MVC 3, only difference is you’ll need to add the scripts manually as bundling is not available out of the box in MVC 3!

 

 

Share this:

  • Twitter
  • Google +1
  • Facebook
  • LinkedIn
  • Reddit
  • Digg
  • Send to Kindle
Posted in ASP.Net MVC - Tagged ASP.Net MVC, C#

How to create custom Outlook rules and execute them programmatically

Dec13
2012
Leave a Comment Written by Pieter van der Westhuizen

The Microsoft Outlook Rules is a very powerful feature that can sometimes get lost amongst the myriad other features and abilities of Outlook. Many Outlook programmers do not realise that Microsoft introduced a new rules object model in Outlook 2007 allowing developers to harness the power of Outlook rules.

In this article we’ll explore aspects of the rule object model and I’ll show you how to create your own rule and how to execute rules on demand on any folder in Outlook 2007, 2010 and 2013.

Read more at Add-in Express.

To see all my most recent Add-in Express blog posts visit my author page.

Share this:

  • Twitter
  • Google +1
  • Facebook
  • LinkedIn
  • Reddit
  • Digg
  • Send to Kindle
Posted in Add-in Express, MS Office - Tagged Ms Outlook

How to replace built-in Outlook dialogs with custom forms

Dec05
2012
4 Comments Written by Pieter van der Westhuizen

Years ago I found this article by Helmut Obertanner on CodeProject. In this article Helmut explains how you can replace the built-in Outlook Address book dialog with your own form. I was amazed and intrigued! This approach is a great way to provide your users with a custom address form that is able to retrieve contact address information from literally any source e.g. CRM or customer database.

So, in today’s article I’ll show you how you can use Helmut’s code in your own Add-in Express projects and how to intercept and customize not just the built-in Outlook Address book dialog but also any other Outlook dialog.

Read more at Add-in Express.

To see all my most recent Add-in Express blog posts visit my author page.

Share this:

  • Twitter
  • Google +1
  • Facebook
  • LinkedIn
  • Reddit
  • Digg
  • Send to Kindle
Posted in Add-in Express, MS Office - Tagged Ms Outlook
« Older Entries

Recent Posts

  • Outlook 2013 and Visual Studio 2012: Getting started for VSTO developers
  • Office 2013 and Visual Studio 2012: Getting started for VSTO developers
  • Excel 2013 single document interface (SDI): How to rebuild your task panes to support it
  • Converting a .vdproj to WiX in Visual Studio 2012, 2010, 2008
  • How to dynamically bind Outlook add-in UI elements to the context

Tag Cloud

.net ACCPAC Add-in Express Advanced Regions ASP.Net ASP.Net MVC C# CRM CSLA CSS Datafier Toolkit deployment Entity Framework Excel HTML In-app Analytics Internet Explorer Java jQuery LINQ MS Access MS Excel Ms Outlook MS Project MVC NHibernate ODBC Office 365 Office 2013 sdk SharePoint 2010 silverlight Source control SQL SQL Connector TrackToAct Twitter VB.net Visio Visual Studio Visual Studio 2012 vsto WCF WiX WSDL

Blogroll

  • David Turvey's Blog

EvoLve theme by Theme4Press  •  Powered by WordPress Mythical Man Moth
IT Mythbusting