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.
About Me
- Ed Richard
- I'm currently the CTO for Hedgehog Technology a business dedicated to delivering Cloud based productivity solutions in Logistics
Thursday, January 24, 2008
More on Social Networking with SharePoint
Rai Umair presented a great session on the concepts of Social Networking within an organisation and how SharePoint can be used in that context. Following up on that I found this post by Lawrence Liu through SharePointPedia which is a great article to read if you want to recap on what Rai told us last night.
Rai's powerpoint can be downloaded here.
Another great way to get the most out of SharePoint for your organisation!
Rai's powerpoint can be downloaded here.
Another great way to get the most out of SharePoint for your organisation!
Presentation File uploaded
The presentation I delivered Tuesday (v.net Dev Sig) and Wednesday (Mossig) has been uploaded to the mossig site for you to have a look at. I've added some brief notes to each of the slides with some background. Both meetings were well attended (over 100 people in total), no doubt not just because of my sessions ;-), there were 4 other great seesions. We've covered WF and WCF in Visual Studio 2008, Social Networking in SharePoint and Windows Rights Management. Thanks for coming guys!
I'll post some code samples and how-to's over the weekend.
I'll post some code samples and how-to's over the weekend.
Tuesday, January 22, 2008
What's new in VSTO v3 for 2008
That's the title of my presentation tonight for the Victoria.net Dev Sig. Here are the details for the meeting, please join us if you can. I'll go into:
Document Level Add-ins
Visual Designers
Ribbon
Task Panes
Form Regions
Workflow
SharePoint
CLICK ONCE!
Word Content Controls
Tomorrow, Wednesday Jan the 23rd is the next Mossig meeting where I'll show you how to build custom Outlook Form regions in 10 minutes. I've got an example of how to show data from your LOB-app based on the email address of the sender of a received email message (wouldn't that be appreciated by your helpdesk people?) and how to convert the html-body of an email into C# code for sending using SMTP. This will all fit into my Show and Tell session of 10 minutes! For the other sessions on wednesday's agenda check out the mossig website.
Document Level Add-ins
Visual Designers
Ribbon
Task Panes
Form Regions
Workflow
SharePoint
CLICK ONCE!
Word Content Controls
Tomorrow, Wednesday Jan the 23rd is the next Mossig meeting where I'll show you how to build custom Outlook Form regions in 10 minutes. I've got an example of how to show data from your LOB-app based on the email address of the sender of a received email message (wouldn't that be appreciated by your helpdesk people?) and how to convert the html-body of an email into C# code for sending using SMTP. This will all fit into my Show and Tell session of 10 minutes! For the other sessions on wednesday's agenda check out the mossig website.
Wednesday, January 09, 2008
Tools galore from Wouter!
If yo are into Word customisation (like me) and deal with Content Controls and Custom XML you are probably aware that the tooling MS provides is not very mature.
Luckily with VSTO there's much you can do to improve that yourself. So I decided just before Christmas to write a little task pane that allows for editing of custom xml-parts and the XML mapping to Content Controls. Much like the tool on Codeplex (www.codeplex.com/dbe) but from within Word.
It turns out Wouter van Vugt had the same idea around the same time....
Here's a quote from his blog:
"The Databinding Toolkit for Word 2007 allows you to store custom XML parts and create data-bound content controls all from within the comfort of the Word user interface. I've developed this Word extension myself because I and some of the people I speak to found this feature to be missing from the default Word user interface. If the old model of xml-mapping has a taskpane, why not the newer and in parts cooler model of data-binding content controls! (You can open the task-pane from the developer tab.) "
In the meantime he's been very productive and worked on WSS 3 and Workflow and another Word Solution for viewing the actual Document in XML. Very nice tools and a very useful blog so do yourself a favour and go and check it out.
Very good stuff Wouter, and thanks very much!
Luckily with VSTO there's much you can do to improve that yourself. So I decided just before Christmas to write a little task pane that allows for editing of custom xml-parts and the XML mapping to Content Controls. Much like the tool on Codeplex (www.codeplex.com/dbe) but from within Word.
It turns out Wouter van Vugt had the same idea around the same time....
Here's a quote from his blog:
"The Databinding Toolkit for Word 2007 allows you to store custom XML parts and create data-bound content controls all from within the comfort of the Word user interface. I've developed this Word extension myself because I and some of the people I speak to found this feature to be missing from the default Word user interface. If the old model of xml-mapping has a taskpane, why not the newer and in parts cooler model of data-binding content controls! (You can open the task-pane from the developer tab.) "
In the meantime he's been very productive and worked on WSS 3 and Workflow and another Word Solution for viewing the actual Document in XML. Very nice tools and a very useful blog so do yourself a favour and go and check it out.
Very good stuff Wouter, and thanks very much!
Thursday, January 03, 2008
I just discovered another great SharePoint resource
A bLog was launched that I completely missed. To be sure I don't forget about it again and because some of you might also have missed it:
Official Blog of the SharePoint Developer Documentation Team
I stumbled upon it after searching for information on how to write a custom workflow activity and make that activity available in SharePoint Designer. Thanks Rodney !
Official Blog of the SharePoint Developer Documentation Team
I stumbled upon it after searching for information on how to write a custom workflow activity and make that activity available in SharePoint Designer. Thanks Rodney !
Subscribe to:
Posts (Atom)