# Configure shared mailbox Office 365 on Mac OS X mail.app

We have recently moved from hosted mail (pop3/imap) to Office365. This works perfectly with Outlook 2016 on Windows. The 2016 mac version of Outlook is also really good. However it just does not auto display the shared mailboxes. This can be easily solved.

just a simple, file –> open –> other users folder. and select the shared mailbox.

## No outlook

It is a lot harder to add a shared mailbox to the default mail.app in Mac OS X. This manual configuration did not work. It suggests to use your main account and a slash and then the shared name or alias.

Here are the configuration details (which did not work for me)

IMAP:

server: outlook.office365.com

(if necessary: Port 993, SSL = ON and Password authentication)

SMTP:

server: smtp.office365.com

(if necessary: Port 587, SSL = ON and Password authentication)

I could not get it to work.

but this did work:

login as admin in office365 go to “users” and not the shared mailboxes.

There are users for shared mailboxes, but no one uses the user account. It is just internally needed for the mailboxes. Click the one that is corresponding with the shared mailbox and reset the password.

You can now use the credentials as above. Just use the pseudo user from the user list and the new password and as mail address the one from the shared mailbox

and outlook.office365.com as server. You can use the default mail.app in Mac OS X (10.10 or 10.11) It is a lot more work then with outlook, but if you are really fond of the default application, this is a solution to keep using it without moving to outlook.

Enjoy and good luck!

# Bulk add contacts to public folder shared contacts Office365/Outlook 2016

We have a lot of customer data in our system and I wanted to have a shared contact list with all the customer data for my co-workers.

I looking into some Office365 docs and found this walkthrough to create the folder: https://www.cogmotive.com/blog/office-365-tips/create-a-company-shared-contacts-folder-in-office-365

So afterwards you have an empty but shared contact folder. I thought that I needed the Microsoft Graph to access these contacts. Which would require my app to be in azure and it cannot have a command line only because of the authentication. More about that approach can be found here http://dev.office.com/getting-started/office365apis

But it seems that this is not needed for my simple one time import https://msdn.microsoft.com/en-us/office/office365/api/contacts-rest-operations

I thought that it might be a job for a PowerShell script and found this http://www.infinitconsulting.com/2015/01/bulk-import-contacts-to-office-365/

But there is an other option. Use Interop, because I as an Office365 user have Outlook 2016 on my Windows 10 machine and Visual Studio 2015. So create a new (console) application and add a reference to Outlook Interop:

I used this code to get to the “customers” address book:

using System;
using Outlook = Microsoft.Office.Interop.Outlook;

{
class Program
{
static void Main(string[] args)
{
var ap = new Outlook.Application();

foreach(Outlook.Folder f in ap.Session.Folders)
{
if (f.Name.ToLower().Contains("openbare")) // jp openbare mappen (public folders)
{
Console.WriteLine(f.FullFolderPath);
foreach (Outlook.Folder f2 in f.Folders)
{
if (f2.Name.ToLower().Contains("alle")) // alle openbare mappen (all public folders)
{
Console.WriteLine(f2.FullFolderPath);
foreach (Outlook.Folder f3 in f2.Folders)
{
if (f3.Name.ToLower().Contains("klanten")) // customers (folder name)
{
Console.WriteLine(f3.FullFolderPath);
foreach (Outlook.Folder f4 in f3.Folders)
{
{
Console.WriteLine(f4.FullFolderPath);
Console.WriteLine("----------");

/// display current items:
//Outlook.Items oItems = f4.Items;
//for (int i = 1; i <= oItems.Count; i++)
//{
//    Outlook._ContactItem oContact = (Outlook._ContactItem)oItems[i];
//    Console.WriteLine(oContact.FullName);
//    oContact = null;
//}

Outlook.ContactItem newContact = (Outlook.ContactItem)ap.CreateItem(Outlook.OlItemType.olContactItem);
try
{
newContact.FirstName = "Jo";
newContact.LastName = "Berry";
newContact.CustomerID = "123456";
newContact.PrimaryTelephoneNumber = "(425)555-0111";
newContact.Move(f4);
newContact.Save();
}
catch (Exception ex)
{
Console.WriteLine("The new contact was not saved. " + ex.Message);
}

}
}
}
}
}
}
}
}

}
}
}



This is not the prettiest code I have written. So there must be a better way. But this is just a one time application to loop through some database records and add contacts. So I will just leave it like this. Please let me know in the comments if you have suggestions to improve readability. The code snippet will give this contact in your (and the rest of the companies) outlook:

If you are looking how to import a folder full with vcf cards you should take a look at this MSDN article.

This should give you enough pointers to bulk add contacts to a shared folder in Office365 (Outlook 2016)

Good luck!

# Macbook air 13” 4mot/4/40000002: exhaust-0

Well the title is clear right? I ran the Apple Hardware Test (AHT) because our model was from 2012.

• Switched off the macbook
• power on macbook
• press and hold ‘D’

I ran the extended and more advance test which takes a bit longer. But it gave me the message:

## 4mot/4/40000002: exhaust-0

it said that the fan was broken. It was exactly what I expected due to the noise of the fan.

Our model was an A1466 and the fan replacement would cost me 145 euro at an Apple care center, so I bought the part online for 26 euro.

Here is the step by step ifixit guide. Please note that you need a P5 pentalobe screwdriver which is Apple specific. I bought it online for 5 euro.

I have spend 38 euro inc shippingcosts. You can get the screwdriver really cheap from aliexpress, but the shipping takes a long time and I cannot live that long without my macbook. Same for the fan it seems. You can get both for 9 dollar without shipping costs but it will take a while to arrive.

On the left is the new one, right side is the old one.

The hardest part was opening the zif connector to reattach the data kabel for the new fan.

The zif connector is so small that it is hard to open.

Running the hardware diagnostics tool can confirm that replacing the fan is a succes. You will not get the 4mot/4/40000002 exhaust error again.

Good luck with the fan replacement!

# Manage users for webform auth missing option in Visual Studio

and then there was this stacktrace and error… I have not had this issue before. It was since the 4.6 framework was installed.

Thankfully I found this stackoverflow answer which resolves it:

in notepad++ and ctrl+g (go to) line 989 and give the string appId the value of “1” instead of the stringutil.blabla

No more error on:

StringUtil.GetNonRandomizedHashCode(String.Concat(appPath, appPhysPath)).ToString("x", CultureInfo.InvariantCulture);

Good luck!

# Calculate km distance between two latitude longitude points from two floats

• Posted in:
• SQL

Having a store locator on my to do list, I started months back with storing the latitude and longitude for the stores in a database. I forked this repository in 2012 https://github.com/bjorn2404/jQuery-Store-Locator-Plugin in order to have something like a store locator on our website. The downside to that store locator is that it is all client side and puts a copy of all your customer data on the internet. It is great data for your competition. So to disclose as little as possible and still serve your valued customers, I decided to do the calculation on the backend. Closest to the data. So that would be on the SQL server.

SQL Server has datatypes like points and geometry since 2008. With this SQL statement you can get the distance between my location

##### lat 51.69917 lng 5.30417 and the locations in the stores table.
SELECT top 10 StoreID
,StoreName
,StoreLatitude
,StoreLongitude
,StoreCity
,round((geography::Point(StoreLatitude, StoreLongitude, 4326).STDistance(geography::Point(51.69917, 5.30417, 4326))) / 1000, 1) as km
FROM STORES
where StoreLongitude < 150 and StoreLongitude > -150 and StoreLatitude < 90 and StoreLatitude > -90
order by (geography::Point(StoreLatitude, StoreLongitude, 4326).STDistance(geography::Point(51.69917, 5.30417, 4326)))



The third parameter for the point data type is 4326 which is an enumeration:

And about 4326 SRID. It also called WSG84(http://en.wikipedia.org/wiki/World_Geodetic_System) system. It's the most common system to represent point on spherical(not flat) earth. It uses degree,minute,second notation and it's x and y coordinates are usually called latitude and longitude.

SRID (Spatial Reference System Identifier) : https://en.wikipedia.org/wiki/SRID

This post is more of a reference for me to lookup how to calculate distances on the Microsoft SQL server in SQL. But maybe it helps others too.

Good luck!