Last week I had some significant trouble creating an install for an Office 2003 template created in Visual Studio 2008 using VSTO 3.0 (but it works on my machine...) . Although there's a lot of docs on MSDN the information is not easy to figure out (guess there's just too much info...). Anyway today I noticed some new tools that were made available during the ODC 2008 and the trouble shooter in particular saved my day. So if you are into VSTO dev, go and get these tools!
Here's how MS describes them:
"A set of developer tools that provide additional functionality useful in Office-based development. These tools include Visual Studio add-ins as well as standalone Windows Forms and console applications. The VSTO Power Tools also include a set of re-usable class libraries to simplify Office development."
Andrew Whitechapel has blogged about this and explains in a bit more detail:
http://blogs.msdn.com/andreww/archive/2008/02/21/vsto-vsta-power-tools-v1-0.aspx
I hope these do end up as fully supported tools either seperate or as part of a Visual Studio service patch.
About Me
- Ed Richard
- I'm currently the CTO for Hedgehog Technology a business dedicated to delivering Cloud based productivity solutions in Logistics
Monday, March 17, 2008
Monday, March 10, 2008
Labour Day - WebCasts Day!
Labour Day: One of these days that you can spend a little time exploring the stuff you had on the todo or to look at list...
I just finished looking at the SharePoint Conference Keynote one of the interesting bits to me was the announcement of a toolkit for using Silverlight in SharePoint solutions. I happen to have done some experimenting with Silverlight and SharePoint last week and there's lots of potential in that area. Just look at how the folks at General Mills have customised their search! Tafiti tailored to their business model all inside SharePoint. Here's the new toolkit:
http://www.ssblueprints.net/sharepoint/
I'm working on a personal site which has a lot of picture viewing, I hope to publish a link in the near future, but gimme some time to play with these Silverlight controls first!
I just finished looking at the SharePoint Conference Keynote one of the interesting bits to me was the announcement of a toolkit for using Silverlight in SharePoint solutions. I happen to have done some experimenting with Silverlight and SharePoint last week and there's lots of potential in that area. Just look at how the folks at General Mills have customised their search! Tafiti tailored to their business model all inside SharePoint. Here's the new toolkit:
http://www.ssblueprints.net/sharepoint/
I'm working on a personal site which has a lot of picture viewing, I hope to publish a link in the near future, but gimme some time to play with these Silverlight controls first!
Friday, March 07, 2008
LINQ 2 Outlook - Part 2
Last night after looking at what's available on LINQ and Outlook and after trying to find some info on the web on what MS might have in mind I decided to experiment with a bit of code myself.
I noticed that most samples use the Outlook collections, which are known for their not so optimum performance when they get bigger and you need to filter out a few items (basically you have to iterate through all of the items).
In Outlook 2007 there's a new class; Outlook.Table (and Row) which allows you to get to the items in a folder and apply an SQL-like filter. This is a very clean and fast way of accessing your items. Combined with LINQ here's some code I came up with, I'm looking to further optimise that using types etc. but wanted to share this simple example anyway.
static void TableTestUsingLinqAndExtensionMethod()
{
Outlook.Application outlook = new Microsoft.Office.Interop.Outlook.Application();
Outlook.MAPIFolder folder = outlook.GetNamespace("MAPI").GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
string filter = @"@SQL=""urn:schemas:httpmail:subject"" like '%devcon%'";
Outlook.Table table = folder.GetTable(filter, null);
var mailitems = from mitem in table.mailitem() select mitem;
foreach (var item in mailitems)
{
if (item[2]!=null)
Console.WriteLine("{0}", item[2].ToString());
}
.....
public static class OutlookTableExtension
{
public static IEnumerable mailitem(this Outlook.Table source)
{
if (source == null)
throw new ArgumentNullException("source");
while (source.GetNextRow()!=null)
{
yield return source.GetNextRow();
}
}
}
Try it out on some large collections and you'll see it is surprisingly fast!
I noticed that most samples use the Outlook collections, which are known for their not so optimum performance when they get bigger and you need to filter out a few items (basically you have to iterate through all of the items).
In Outlook 2007 there's a new class; Outlook.Table (and Row) which allows you to get to the items in a folder and apply an SQL-like filter. This is a very clean and fast way of accessing your items. Combined with LINQ here's some code I came up with, I'm looking to further optimise that using types etc. but wanted to share this simple example anyway.
static void TableTestUsingLinqAndExtensionMethod()
{
Outlook.Application outlook = new Microsoft.Office.Interop.Outlook.Application();
Outlook.MAPIFolder folder = outlook.GetNamespace("MAPI").GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
string filter = @"@SQL=""urn:schemas:httpmail:subject"" like '%devcon%'";
Outlook.Table table = folder.GetTable(filter, null);
var mailitems = from mitem in table.mailitem() select mitem;
foreach (var item in mailitems)
{
if (item[2]!=null)
Console.WriteLine("{0}", item[2].ToString());
}
.....
public static class OutlookTableExtension
{
public static IEnumerable
{
if (source == null)
throw new ArgumentNullException("source");
while (source.GetNextRow()!=null)
{
yield return source.GetNextRow();
}
}
}
Try it out on some large collections and you'll see it is surprisingly fast!
Thursday, March 06, 2008
LINQ 2 Outlook
During the keynote at the Heroes Happen {2008} launch event in Melbourne last Tuesday Jason Zander, the General Manager of the Visual Studio team made a quick reference to what he called Linq 2 Outlook which would come out of Redmond in the near future. On the search for info on this I stumbled upon many bloggers already using Linq against the Outlook object model. A very interesting approach comes from Belgium, good stuff from Stefan Cruysberghs. Seriously worth having a look at if you're into Linq (and /or Outlook 2007). He also wrote a class for accessing OneNote 2007.
Saturday, February 23, 2008
Out Of The Box
I always like using Out Of The Box features, pre-tested, reliable and quick to deploy and start using for the customer.
I've often wondered about this aspect of SharePoint, I know of the 40 or so Site Templates for SharePoint but that only scratches the surface about what could be done in this space. Lately I've been experimenting a bit with Office Live and it's very interesting to see the developments there (an example).
Last week MS published new Document Library templates for SharePoint that come pre-configured with appropriate templates. I'm particularly glad to see the use of Content Controls and how they link to the Document Library properties. From my perspective, just reading the .docx that come with the new templates is reason enough to spend some time investigating them and think about how you organisation could benefit from a similar approach.
Friday, February 01, 2008
Following up on my presentations of last week

If you want to know more about VSTO v3 and it's role in developing Office Business Applications you should really read this recent article by Erika Ehrli and Steve Fox.
Here's a link to Erika's excellent blog.
Thursday, January 24, 2008
Hooking up to an Item Changed Event in VSTO
After last night's mossig meeting and my Outlook/VSTO presentation someone asked me about the following scenario:
"I want to capture the fact that a user changes an email address in the Outlook contacts list and call into a custom Web Service to update my LOB-system recording that change." For those that have used the Outlook object model before that is probably not a difficult task, for those new to Outlook and tempted by VSTO to give Office Integration a go it may not be so obvious so I decided to write a little bit of demo-code in C# to show how to setup the event handler, I'll leave the actual call to a Web Service or updating a database using .net classes up to the student as an exercise ;-). Start by creating a new Outlook Addin project, open ThisAddIn.cs and add the code below.
.....
using Outlook = Microsoft.Office.Interop.Outlook;
using Office = Microsoft.Office.Core;
.....
public partial class ThisAddIn
{
Outlook.MAPIFolder contactfolder;
Outlook.Items items; // This on is important, keep the reference at the addin level, a local var in the startup method will get garbage collected and the events will stop firing.
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
Outlook.NameSpace ns;
ns = this.Application.GetNamespace("MAPI");
contactfolder = ns.GetDefaultFolder
(Outlook.OlDefaultFolders.olFolderContacts);
items = contactfolder.Items;
items.ItemChange +=
new Outlook.ItemsEvents_ItemChangeEventHandler(ItemChanged);
}
private void ItemChanged( object item )
{
Outlook.ContactItem contact;
contact = (Outlook.ContactItem)item;
// This is were you do your thing......
System.Windows.Forms.MessageBox.Show(contact.Email1Address);
}
.....
The same is available for ItemAdd, for delete events you would have to hookup an ItemAdd to the DeletedItems folder.
"I want to capture the fact that a user changes an email address in the Outlook contacts list and call into a custom Web Service to update my LOB-system recording that change." For those that have used the Outlook object model before that is probably not a difficult task, for those new to Outlook and tempted by VSTO to give Office Integration a go it may not be so obvious so I decided to write a little bit of demo-code in C# to show how to setup the event handler, I'll leave the actual call to a Web Service or updating a database using .net classes up to the student as an exercise ;-). Start by creating a new Outlook Addin project, open ThisAddIn.cs and add the code below.
.....
using Outlook = Microsoft.Office.Interop.Outlook;
using Office = Microsoft.Office.Core;
.....
public partial class ThisAddIn
{
Outlook.MAPIFolder contactfolder;
Outlook.Items items; // This on is important, keep the reference at the addin level, a local var in the startup method will get garbage collected and the events will stop firing.
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
Outlook.NameSpace ns;
ns = this.Application.GetNamespace("MAPI");
contactfolder = ns.GetDefaultFolder
(Outlook.OlDefaultFolders.olFolderContacts);
items = contactfolder.Items;
items.ItemChange +=
new Outlook.ItemsEvents_ItemChangeEventHandler(ItemChanged);
}
private void ItemChanged( object item )
{
Outlook.ContactItem contact;
contact = (Outlook.ContactItem)item;
// This is were you do your thing......
System.Windows.Forms.MessageBox.Show(contact.Email1Address);
}
.....
The same is available for ItemAdd, for delete events you would have to hookup an ItemAdd to the DeletedItems folder.
Subscribe to:
Posts (Atom)