Thursday 27 December 2012

EWS Post 2 of n - Finding Folders


The EWS SDK can be found here.

I suggest using Linqpad to run these code snippets as that is where they are being written.

Just add a reference to C:\Program Files\Microsoft\Exchange\Web Services\2.0\Microsoft.Exchange.WebServices.dll and a using statement for Microsoft.Exchange.WebServices.Data and you're good to go.


Part 2 of n in my EWS series, this time covering finding folders. This is a two liner, barely worthy of it's own blog post, but it's late and, for something so simple, there seem to be alarmingly few straight forward examples of this on the interwebs, so enjoy.


var service = new ExchangeService(ExchangeVersion.Exchange2010);
service.Credentials = new WebCredentials("myusername","mypassword");
service.Url = new Uri("https://mymailserver/ews/exchange.asmx");


var f = new FolderView(100);
var res = service.FindFolders(WellKnownFolderName.PublicFoldersRoot,f);

Tuesday 20 November 2012

EWS Post 1 of n - Sending an email

I've been digging in to the basics of using Exchange Web Services recently and thought it worthy of a few blog posts. These won't be the perfectly crafted literary masterpieces of the Hanselmans of the world, but rather brain farts and code dumps to play with.

The EWS SDK can be found here.

I suggest using Linqpad to run these code snippets as that is where they are being written.

Just add a reference to C:\Program Files\Microsoft\Exchange\Web Services\2.0\Microsoft.Exchange.WebServices.dll and a using statement for Microsoft.Exchange.WebServices.Data and you're good to go.

Sending an email using EWS is astonishingly simple and consists of just 8 lines of code:


var service = new ExchangeService(ExchangeVersion.Exchange2010);
service.Credentials = new WebCredentials("myusername","mypassword");
service.Url = new Uri("https://mymailserver/ews/exchange.asmx");

EmailMessage message = new EmailMessage(service);
message.Subject = "Interesting";
message.Body = "The proposition has been considered.";
message.ToRecipients.Add("pointhairedboss@thecompany.com");
message.SendAndSaveCopy();

Saturday 24 March 2012

Speeding up Azure debugging your MVC application


When debugging an application that is intended for an Azure Web Role, you debug using the Compute and Storage emulators in order to give you a realistic Azure experience. These tools used to take a long time to initialize on Build, meaning debugging your app could take significantly longer than normal. Even though the tools have become a lot quicker, there is still an additional delay when debugging using them.

If, like me, you have just migrated a bog-standard web application to Azure and are not yet using any of the specific Azure features, essentially treating Azure as a web server and nothing else, there is something you can do to speed things up.

In your solution, simply change the start up project from the Azure Web Role to the actual MVC project that is going to be deployed in the Azure Web Role. This way you can debug in the normal way and then deploy to Azure when ready.

Note however, that if you start using any of the Azure features such as Blob, Table or Queue storage, then you just need to change the Start Up Project back to the Azure Web Role project

Saturday 3 March 2012

Server 8, Win 8 and VS 11 - first impressions

It's been a busy week for Microsoft, releasing the first Beta of Windows Server 8, the Consumer Preview of Windows 8, and the beta of Visual Studio 11. But have the changes they've made been positive ones? These are my first impressions.

Server 8
After experiencing a hiccup with Virtualbox involving only having one CPU assigned to the VM, the install of the Core configuration took less than 15 minutes which I was very impressed by.
The performance is surprisingly good, far exceeding previous experiences with Server 2008 VMs, even Server Core installations. Running a fresh installation running as a domain controller with only 2Gb of RAM results in boot times of less than 15 seconds and really responsive performance from the minimal UI.
I have only one minor gripe from my initial few hours of testing. Despite Microsoft's big push to get admins using Powershell for all their server tasks, therefore eliminating the need for a UI and increasing the server's efficiency, the default shell for server core is still a standard command prompt. I was fully expecting a Powershell Window here. Also, would it kill to make it full screen so I can make full use of my monitor? I know the emphasis is on remoting, but would it kill to support someone logging onto the machine and wanting a full screen command line?

Windows 8
As much as I hate to say it, I expect Windows 8 to be a flop on the desktop, much as Vista was. The reason for this is that it has a serious split personality disorder. As a tablet OS, I like Metro and am even considering a WinPho for my next upgrade. As a desktop OS, I'm pissed about the disappearance of the Start button but think the changes they have made to Windows Explorer are long overdue and a definite improvement.
The problem here is that Microsoft have tried to make an OS that works on the Tablet AND the desktop, and I think that is a massive mistake. As long as you only need to use either Metro or Classic, it will be a fine OS. If you need to transition between the two, the cracks between Windows 8's dual personalities start to show and things start to look awfully shoddy.
I can only hope that Microsoft resolve this before release or we could see the same story of enterprise holding on to Windows 7 far beyond it's life in exactly the same way as they did with XP.

Visual Studio 11.
It seems as if the Visual Studio team have spent a great deal of time since 2010 was released fiddling with icons and trying to make VS11 as retro as possible. The key differences between 2010 and 11 are simple, toolbar headers filled with colons that look straight out of the early 90s. I'm sure I saw them in an old OS but just can't put my finger on which one! There is also the case of the ALL CAPS WINDOW TITLES WHICH ARE REALLY ANNOYING AND EXTREMELY DISTRACTING. Other than this and changing the icon set, I haven't seen any real differences as yet. I can only hope that VS11 grows on me as I use it more.
Friendly warning, if you are using the built in Windows Setup projects, do not install VS11. My boss hasn't been able to build an installer since he installed this, not even after uninstalling it and uninstalling/reinstalling VS2010 and multiple other components.

Verdicts
Bit of a mixed bag from Microsoft here. Hopefully the issues with Win8 and VS11 will be resolved by RTM, and Server 8 is looking like a very promising release. Now they just need to make them all play a little nicer with Virtual Machines!

Wednesday 8 February 2012

A future Asus hit surely

Two posts in one day, yep, I'm bored and flash Pool can only eat up so much time.

This has apparently been rumoured for a while but has thus far managed to escape my attention. Asus will be releasing a phone that is also a tablet. Add on the keyboard from their Transformer Tablet cum laptop and you've got a phone, a tablet, and a small laptop.

It's called the Padfone, not the most original product name of all time, and is basically a phone that slots in to the back of a screen+battery chassis. You can also dock it with the aforementioned keyboard from the Transformer and you've got yourself a laptop. The Tablet chassis will also charge your phone battery while they're connected.

Scheduled to be released in the first half of this year, if it comes out for a decent price I will certainly be seeking an upgrade when my phone contract expires later in the year.

Android - Unable to update apps on SD Card

I've had my HTC Desire for over a year now and, among the many bugs and annoyances that seem to be sneaking their way in to my daily phone-using experience, the most annoying is the recent inability to update any apps I have on my SD Card. Due to the diminutive size of the Desire's internal storage, ALL of my apps are on the SD Card, making this quite a large problem.

My solution up until now has been to move the offending apps back to the phone, update them, and then move them back to the SD Card.

Fortunately, Nick Damoulakis has a better idea.

Summarised below just in case the original becomes unavailable in the future.


  • Connect your phone to your PC

  • When the connection is detected by the phone, it may ask you if you wish to switch to USB storage. Say yes.

  • From your PC, go to the phone's drive (that should have just appeared in Explorer) and navigate to /sdcard/.android_secure/.

  • Find the file called smdl2tmp1.asec and delete it

  • Disconnect the phone

  • Done!!



Thanks a lot Nick, this has saved me a massive amount of time and hair.