Share via


VSTO Power Tools

If you do any Office development, then you need to check out the VSTO Power Tools v1.0.0.0 which include:

  • Open XML Package Editor
  • Ribbon IDs Tool Window
  • Office Custom UI Manager
  • Office Interop API Extensions
  • SharePoint Feature Sweeper
  • SharePoint Workflow Package Generator
  • VSTO/VSTA Pipeline Verifier
  • VSTO Developer Cleaner
  • VSTO Troubleshooter

The VSTO Power Tools work with Office 2007 and Visual Studio 2008. I particularly like the code examples given in the documentation for the Office Interop API Extensions:

Saving a Word document
  // Using the standard PIAs: 
object fileName = "Foo.html";
object missing = Type.Missing;
object saveFormat = Word.WdSaveFormat.wdFormatHTML;
doc.SaveAs(ref fileName, ref saveFormat,
    ref missing, ref missing, ref missing, ref missing, ref missing,
    ref missing, ref missing, ref missing, ref missing, ref missing,
    ref missing, ref missing, ref missing, ref missing);

 // Using the Office Interop API extensions: 
doc.SaveAs("Foo.html", Word.WdSaveFormat.wdFormatHTML);
Querying Outlook data using LINQ query expression syntax
  // Using the standard PIAs: 
string filter = @"@SQL=(""urn:schemas:httpmail:subject"" LIKE '%" + subject.Replace("'", "''") + 
                                @"%' AND ""urn:schemas:httpmail:date"" <= '" +
                                (DateTime.Now – new TimeSpan(7, 0, 0)).ToString("g") + @"')";

Items restrictedItems = folder.Items.Restrict(filter);

foreach (MailItem item in restrictedItems)
{
    Console.WriteLine("Body: {0}", item.Body);
}

 // Using the Office Interop API extensions: 
var results = from item in folder.Items.AsQueryable&lt;Mail&gt;()
              where item.Subject.Contains(subject) 
              &amp;&amp;    item.Sent &lt;= DateTime.Now – new TimeSpan(7, 0, 0)
              select item.Body;

foreach (var result in results)
{
    Console.WriteLine("Body: {0}", result);
}

Technorati Tags: office,powertools

Comments