Category: programming

You should learn a framework–advice to starting programmers

There are many posts about getting to learn programming. And, of course, all starts with the simple instructions: + , –, % … Then things get somehow more complicated learning modular programming ( or functional, if you do not use global variables …)

After this, you start learning about classes and instances ( Plato is the master here) and overriding and deriving … And maybe some Design Patterns( please, do not talk about Singleton…)

Maybe you learn a bit about Sql( Tables and Views and StoredProcedures) and NoSql …

And after that, you have the basics to write code in any kind of language . But, when you want to start a new application

  1. How you start it  ?
  2. What are the deliverables ?
  3. How to make the Graphical User Interface ?
  4. How to make components ?
  5. and so on …

That’s what a  framework brings to the table: a clear way /  path to do applications. In my case I am talking about .NET Core / C# n(Console applications, Web Applications, Forms application ) . Also, you may want to separate Front End from Backend – Angular or Vue or … could help with that ( and .NET remains just an WebAPI layer) . A framyework ( or 2  – Front End and BackEnd) will teach you how to make possible an application without hassle.

Yes, it is true that the framework is constraining a lot- you do things the framework way, not your way . So what ? You want to get your first application done. The framework is showing you the path – you can walk under it. And you know that, if you do not walk the path, then “hic sunt leones” . You know also that the framework protect you from the problems.

So my advice to young programmers: Learn a framework . Then you could do your first application. And the second. Then you could you start questioning some of the decision of the framework that might not suit your application.

Developing an outlook helper–part 5 from 5–conclusions

Series

 

Developing Outlook helper – introduction

Developing Outlook helper-VBA macro

Developing Outlook helper-C#

Developing Outlook helper – javascript for Office 365

Developing Outlook helper – conclusions

As you see, the developing and testing the Outlook  simple application was made significantly and increasingly difficult . The start point also is more difficult.

Think now about a real application and his verticals also(  saving data / settings, logging, security / authorization , errors …)

What is relatively simple is the upgrade process that is simpler now (  did not mention, but involves just a re-deploy to Microsoft Store)

Another important thing : All the methods to create the application are available. This is beautiful and scaring ….

Developing an outlook helper–part 4 from 5–javascript / Office 365 project

Series

 

Developing Outlook helper – introduction

Developing Outlook helper-VBA macro

Developing Outlook helper-C#

Developing Outlook helper – javascript for Office 365

Developing Outlook helper – conclusions

Develop like it was 201x:

Read about Office Javascript API and try to understand the documentation – https://dev.office.com/docs/add-ins/develop/understanding-the-javascript-api-for-office . Then realize there are some samples where you can start: https://dev.outlook.com/Samples/Addins .

You find Hello World addin (https://github.com/jasonjoh/hello-world-addin) and decide to try it. Download to the PC . The files are

C:\Users\aignat\Downloads\hello-world-addin-master\hello-world-addin-master
.gitattributes
.gitignore
app
HelloWorld.xml
LICENSE.TXT
README.md
app\compose
app\content
app\images
app\read
app\scripts
app\compose\App.css
app\compose\App.js
app\compose\Home
app\compose\Home\Home.css
app\compose\Home\Home.html
app\compose\Home\Home.js
app\content\Office.css
app\images\Close.png
app\read\App.css
app\read\App.js
app\read\Home
app\read\Home\Home.css
app\read\Home\Home.html
app\read\Home\Home.js
app\scripts\jquery-1.9.1.js

You find eventually the code that reads the email data ( in the Home.js ) and displays data(in the Home.html)

You see that this line finds the email

var item = Office.cast.item.toItemRead(Office.context.mailbox.item);

You want to modify the  code. You do not have intellisense helpers, but just documentation.

Test like it was 201x:

SO you have now a bunch of files. How to test it? You cannot test with Outlook. You do not want to deploy to Microsoft store yet. It is testing, right?

You read again what it should be done from       Hello World addin (https://github.com/jasonjoh/hello-world-addin) – and now I am quoting

"

  1. Copy the app directory from the project to your web server.
  2. Open manifest.xml in a text editor and update all instances of https://<your web server> to the base URL of the directory on your web server where you deployed the app directory.
  3. Logon to Outlook Web Access. Click on the gear cog in the upper right corner of the page and click on Manage apps.
  4. On the Manage apps page, click on the ‘+’ icon, select Add from file. Browse to the manifest.xml file included in the project.
  5. Return to the Mail view in Outlook Web Access.
  6. To try the read mode functionality of the add-in, open any message and launch the HelloWorld app from the app bar.

“ – end quoting

So you need

  1. a https server  with FTP account to deploy files
  2. an Outlook 365 account

Once you have those, it is a simple process:

  1. Copy files to the https server.
  2. Goto Outlook 365 settings, load addon from HelloWorld.xml .
  3. Verify if all ok
  4. If not, unload the addon from Office 365.
  5. Modify the files to make the app .
  6. GOTO 1

Deploy like it was 201x:

Pass to the Microsoft Store to get a developer ID and deploy to their server the application.

Developing an outlook helper–part 3 from 5–C# project

Series

 

Developing Outlook helper – introduction

Developing Outlook helper-VBA macro

Developing Outlook helper-C#

Developing Outlook helper – javascript for Office 365

Developing Outlook helper – conclusions

Develop like it was  200x:

Start  Visual Studio. See that you do not have the project. Download the Office addon for VS that create the project. Find the Outlook project – that is a wizard and let you have some choices . Give a name and wait for Visual Studio to load all files.

Those are the files generated by VS2013 ( differs from version to version)

app.config
Properties
Resources
ThisAddIn.cs
ThisAddIn.Designer.cs
ThisAddIn.Designer.xml
FindInEmail.cs
FindInEmail.Designer.cs
FindInEmail.resx
FindInEmailIn.csproj
FindInEmailIn.csproj.user
FindInEmailIn.sln
FindInEmailIn_TemporaryKey.pfx
FindSettings.cs
FindSettings.Designer.cs
FindSettings.resx
.vs\FindInEmailIn
.vs\FindInEmailIn\v14
Properties\AssemblyInfo.cs
Properties\Resources.Designer.cs
Properties\Resources.resx
Properties\Settings.Designer.cs
Properties\Settings.settings

After a while, you realize that you want a button in the ribbon.  You will find eventually the http://www.visualstudioextensibility.com/ site where Carlos Quintero maintains various blog posts about that and understand how to add the ribbon button and how to intercept clock event . Then you wrote more or less the same code as in part 2 :

var m = Globals.ThisAddIn.Application.ActiveInspector().CurrentItem;
MailItem mi = m as MailItem;
if (mi == null)
      return;
//C# same code as in http://msprogrammer.serviciipeweb.ro/2017/01/30/developing-an-outlook-helperpart-2-from-5vba/ 

Test like it was 200x:

Press F5 to run the project. Outlook starts and loads the plugin. So now there are 2 resource hogs on your system: Outlook + Visual Studio. Set break point in VS . Open the email. Find the ribbon in Outlook. Press the button and debug.

Deploy like it was 200x:

Create a VS Setup project and pray

    1. user have the same .NET Framework version that you have developed with
    2. user have the same  Outlook version that you have developed

( There are solution for 1 and 2 to be integrated – but it requires some programming / settings)

Developing an outlook helper–part 2 from 5–VBA

Series

 

Developing Outlook helper – introduction

Developing Outlook helper-VBA macro

Developing Outlook helper-C#

Developing Outlook helper – javascript for Office 365

Developing Outlook helper – conclusions

Develop like it was ‘9x:

In the early days to develop an outlook addon it was simple : Press ALT+F11 and wrote the VBA. ( in our days , you go to the outlook settings and enable macros)

The code will be something like this:

Public Sub IsUserInEmail()
    Dim current
    Set current = Application.ActiveInspector.CurrentItem
    
    If Not TypeOf current Is MailItem Then Exit Sub
    Dim m As MailItem
    Set m = current
    
    Dim name As String
    name = InputBox("Please give me the user name", "Find User")
    If (Len(name) = 0) Then Exit Sub
    
    
    If (InStr(1, m.To, name, vbTextCompare) > 0) Then
        MsgBox "The name " & name & " has received the email"
        Exit Sub
    End If
    If (InStr(1, m.Sender.name, name, vbTextCompare) > 0) Then
        MsgBox "The name " & name & " has received the email"
        Exit Sub
    End If
    Dim rec As Recipient
    For Each rec In m.Recipients
        If (InStr(1, rec.name, name, vbTextCompare) > 0) Then
            MsgBox "The name " & name & " has received the email"
            Exit Sub
        End If
    Next rec
    MsgBox "The name " & name & " has NOT received the email"
    
End Sub

Test like it was ‘9x:

If you want to test, open the email ( double click the email) . Then run with F5 and debug.

Deploy like it was ‘9x:

Send to the user the VBA script and tell him step by step how to copy / paste

Developing an outlook helper–part 1 from 5

Series

 

Developing Outlook helper – introduction

Developing Outlook helper-VBA macro

Developing Outlook helper-C#

Developing Outlook helper – javscript for Office 365

Developing Outlook helper – conclusions

I want to show how much the software have changed from the early days to now.

For this , I will show it was / is to develop / test / deploy a sample outlook macro/application that allows the user to find if a name is between the email addresses from an email ( in a international company this is rather a difficult task).

The part 2 will be implementation as  an Outlook VBA Macro

The part 3 will be a VS addon application

The part 4 will be a modern Javascript Office 365 application

In the part 5 I will put the conclusions – but I think that you have an idea about what I am talking.

Andrei Ignat weekly software news(mostly .NET)

* indicates required

Please select all the ways you would like to hear from me:

You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.