Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
For you Microsoft Outlook users, here are two little command-line utilities that let you create and pop up Outlook Notes. They are pretty simple, but may serve as examples of how to use Win32::OLE productively with Outlook Notes (as opposed to Lotus Notes ;-)
#!perl use warnings; use strict; use Win32::OLE; use Win32::OLE::Const 'Microsoft Outlook'; use Getopt::Long; =pod This reads the note contents from <>, so you can type into it or pipe into it from another program, for example. The Subject is calculated from the Body - specifically, it is taken from the first line of the Body, at the time the Save operation is performed. A NoteItem contains the following properties (not all of which are set +table): Application Class Session Parent Body Categories Color CreationTime EntryID GetInspector Height LastModificationTime Left MessageClass Saved Size Subject Top Width Links DownloadState ItemProperties MarkForDownload IsConflict Colors are enumerated as follows: 0 Blue 1 Green 2 Pink 3 Yellow 4 White =cut my @colors = qw( blue green pink yellow white ); my %colors; @colors{@colors} = (0 .. $#colors); my $color; GetOptions( 'color=s' => \$color ); my $ol = Win32::OLE->new('Outlook.Application') or die "Unable to create an Outlook context: $!\n"; my $noteitem = $ol->CreateItem( olNoteItem ) or die "Unable to create a new Note: $!\n"; undef $/; $noteitem->{'Body'} = <>; # sluurp if ( defined $color ) { my $i = $colors{lc $color}; defined $i and $noteitem->{'Color'} = $i; } $noteitem->Save;
#!perl use warnings; use strict; use Win32::OLE; use Win32::OLE::Const 'Microsoft Outlook'; =pod This takes the value of a note Subject from the command line arguments +, looks for a note with that identification, and displays it. If no note is found with the given Subject, an OLE error results. =head1 TO DO Allow searching for notes in subfolders. E.g. Given note name "Archive/How To", we will search in subfolder "Archive" for a note named "How To". =cut Win32::OLE ->new('Outlook.Application') ->session ->GetDefaultFolder( olFolderNotes ) ->Items( "@ARGV" ) ->Display;

jdporter
The 6th Rule of Perl Club is -- There is no Rule #6.


In reply to Create and Pop Up Outlook Notes from Perl by jdporter

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (8)
    As of 2015-07-04 17:50 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (60 votes), past polls