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();

Friday, 16 November 2012

PCC elections and why no one cares.

The Police Crime Commissioner elections came and went in the UK, and shockingly no one gave a shit.

Voter turn out was around 15% which is at least 5% more than I was expecting. The reasons for such low turn out are numerous and immeasurable and I'm sure everyone who can be arsed has an opinion on why no one could be bothered.

Personally, the reason I didn't bother voting is because I simply do not see the point of the whole thing and the Government have not made any effort to convince people of why they should care.

The single argument they can come out with is that the current equivalent aren't elected, whereas PCCs will be. However, they've given no reason why this means they'll do a better job. My binman isn't elected but I'm pretty sure that if someone were elected to replace him, the very fact that they were elected doesn't mean they'll do a better job.

 I don't know how the equivalents worked and how someone became one, but I would like to think that it was a role someone achieved by proving themselves through action and experience, not by being voted in by the 4 people in the county who could be bothered.

The PCCs, while they may have the best of intentions, will ultimately be looking to do what will keep them in the voters' good books and get them re-elected.

Telling people "you've got to vote because we're letting you whereas we didn't before" is not sufficient reason to vote.

And in a disturbing twist, the guy who won in my local region is the one who wants to "Give budgets to communities, involving them more in their own protection.". Ugh.

Saturday, 10 November 2012

Elections

A few people have been asking me lately why I was so interested in the American Presidential elections when I generally pay very little attention to UK politics.

Casting aside the completely different scale of theatrics and deceit that goes on in the POTUS elections as opposed to the UK elections which is just several months of the candidates taking pathetic and generally irrelevant schoolboy-like pot shots at each other, the very simple answer is that Americans actually have a choice.

Let's list the choices we had when we ended up with the ConDem coalition government.

Labour & Gordon Brown - In fairness, I think Gordon took a lot of unnecessary flack for not predicting a financial meltdown that the rest of the world didn't see coming. Having said that, Labour made a lot of mistakes and had practically scandalised themselves out of office.
Conservatives & David Cameron - Out of touch toffs I wouldn't trust as far as I can throw them.
Lib Dems & Nick Clegg - Some good policies on paper and I actually did consider voting for them before concluding that a vote for them was essentially a wasted vote, and I really didn't want the Conservatives to win.

Regardless of who you voted for, it was going to be the same shit of cuts, corruption, and false expenses claims.

American had a choice between a President who had not done everything he said he would but has generally done a good job, or Mitt Romney, a religious fundamentalist nut-job whose party if full of men with questionable views on rape and women's reproductive rights.

They had a real choice, we ended up with a tosser either way. In the end, we ended up with two tossers and the Lib Dems ensured that I will never again even consider voting for them.

UK Police Commissioner elections

Next week, everyone in the UK has the opportunity to vote for a Police Commissioner to control the priorities of their local Police force.
 Admittedly, I haven't been keeping to close of an eye on this but I had always assumed that a Police Commissioner should be an actual Police Officer who actually knows something about the Police.

Instead, it would appear that this is just another example of politicians creating jobs for themselves. Politicians who know shit all about policing having their hands even further in the day to day running of the Police force. Police forces should be run by the Police, not by politicians who are just in it for the expenses claims.
 Reading through the manifestos of my local candidates, all but one of them has no experience in the force and, where they provide actual details of what they will do rather than just talking about their hobbies, their ideas are a combination of plain common sense that anyone on the street could come out with, and the idiotic, such as putting budgets in control of local communities.
 What the hell do people in the community know about Police budgets? I would know absolutely nothing about where Police money should be spent, which is why I'm not in charge. But it appears, in this new world of making the average Joe on the street feel like he's the boss (he's not), we spend time and money consulting him/her on what they think the money should be spent on (when they probably don't have a clue) then either ignoring them (making the entire exercise pointless) or doing as they suggest (risking large amounts of public money being wasted on ideas from idiots).

The UK Police have had a fair bit of bad press over the last few years, a lot of which can be attributed to media sensationalism and some officers trying a little too hard to reach their targets. But over all, they do a tough job and get nothing but shit for it, now we put some self-serving politician in their way who's priorities are making sure they do what they need to get re-elected.

Yet another fail from the ConDem Coalition, and one which I'm sure Labour will be quick to reverse when they get back in to power.

Rant done.

Saturday, 3 November 2012

American Presidential Elections

I'm not American and I don't live in America, but I am still dreading the possibility of Mitt Romney becoming the President of the USA.
 The man has flip-flopped on vital issues more times than I've had hot meals and I doubt even he wonders where he stands on the vital issues now.

No one looks at this blog, and that's fine. But if you are viewing this blog, and you're American, and it's before the 6th November 2012, please think about who you vote for.

Romney's policies boil down to:

  • His God has more say over what every woman in the USA can do with her body than said woman. They can't have abortions (with exceptions for rape, incest, and life of the mother that he has been forced in to accepting), and at the same time he will seriously restrict the availability of contraception. These two individually aren't sensible, together it is just damn stupid. Watch out for an explosion in unplanned births if he gets his way.
  • He wants to shut down FEMA and leave the handling of disasters to individual states which won't have the same expertise as FEMA, or the private sector who have their profit margins to look after.
  • He'll reduce taxes for his rich mates and screw over the middle-class.
  • Add to that his extreme arrogance that he somehow deserves the position and believes that America will be untouchable under his leadership, and you've got a very dangerous man leading the most powerful country in the world who thinks he is merely doing God's work and can use this to absolve all moral responsibility.
Obama's not perfect either. He hasn't achieved everything he said he would in his first time, but he is far less dangerous than Mitt Romney.

So if you are going to the polls, check out http://www.factcheck.org/ who are working to expose Romney's lies, don't put the inmates in charge of the asylum.

Vote Obama.