Thursday, March 20, 2014

Multiple types were found that match the controller named 'MyController' in the Web API

This is a really dumb error. It happened to me after renaming some projects in the solution, and the way to fix it is deleting the files in the bin directory and rebuilding the code. Thanks stackoverflow!

Monday, March 17, 2014

Invoking the ASP.NET Web API from a client in .NET 3.5

It's actually pretty simple. I followed this post, but basically you just have to do the following.

public static object postWebApi(object data, Uri webApiUrl) {
    // Create a WebClient to POST the request
    WebClient client = new WebClient();

    // Set the header so it knows we are sending JSON
    client.Headers[HttpRequestHeader.ContentType] = "application/json";

    // Serialise the data we are sending in to JSON
    string serialisedData = JsonConvert.SerializeObject(data);

    // Make the request
    var response = client.UploadString(webApiUrl, serialisedData);

    // Deserialise the response into a GUID
    return JsonConvert.DeserializeObject(response);

Saturday, March 15, 2014

Installing Exchange Server 2007 Prerequisites

I found myself doing this to learn Exchange for a project. Following these steps helped me through the process.

Sunday, March 9, 2014

Exchange 2007 EWS - The connection to the mailbox is unavailable

I've been using EWS and after an Exchange Server reboot, this message appeared when connecting to EWS: "The connection to the mailbox is unavailable".

The first place where I thought I should start was the Services module in the Exchange mailbox. Just make sure the Microsoft Exchange services (specially the Microsoft Exchange Information Store) are up and running. Of course, there maybe several reasons for this error, it turned out that for me this fixed it.

Tuesday, March 4, 2014

The (real) way to delete a contact email in EWS (Exchange Web Services)

I've found several posts on how to delete the email of a contact. Of course, setting it to null doesn't work. This is what worked for me: first, follow the instructions on this blog.

But first make sure you read these properties when retrieving the contact to be updated. I was not doing that and it took me a couple of hours to figure out.