Monday, 5 April 2010

Opening the Internal web Browser in Outlook using VSTO

It might sound like a simple thing, and when you look at the code it really is, but finding this tiny little snippet has taken absolutley ages to track down. Anyway, Big big big thanks to Mostafa Elzoghbi and his blog entry which can be found here...

And, for the impatient, the code is basically...

// Use this to find the webbrowser control
Office.CommandBarComboBox webControl1 = (Office.CommandBarComboBox)this.Application.ActiveExplorer().CommandBars.FindControl(26, 1740, missing, missing);

// use this to navigate to whatever site you want to
webControl1.Text = "";

Thanks again Mostafa!


Tuesday, 9 February 2010

EWS Managed API through a Proxy Server

So I have been doing a bit more EWS stuff recently and part of that was to access an exchange server on the internet from behind a web proxy server. This threw up an error which had me a bit annoyed and after a fair bit of searching the web for an answer I found the following

The upshot being:-
  • You cannot specify a proxy server/credentials on a service by service basis - BAD TIMES
  • You CAN tell your application to use the default credentials for any proxy server it encounters while trying to make a request.. The answer lies in the following bit of code

WebRequest.DefaultWebProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;

For VB.NET, just remove the semicolon at the end of the line and place it above where you initialise your Exchange connector. Worked a treat for me ;-)

All credit to Mr David Claux for finding this one....