Ok, I wrote it and tested it with form=appointment-documents, but it might work with pretty much any notes document (see code below).

Thanks diotalevi and Zero_Flop for your insights! Since I don't need to look at more than a handful of documents, I'll stick to GetNthDocument for the time being.

As it turns out, the most difficult thing to analyze is the array returned by GetItemValueDateTimeArray since it can contain either NotesDateRange or DateTime. Is there any better way of telling which it is other than looking at the ItemName like I've done here?

#!/usr/bin/perl -w use strict; use Notes::OLE; use vars qw( $SERVER ); $SERVER=''; # empty when querying local client my $mailfile='mail\myshortname.nsf'; my $maxdocs=50; # 0=all my $maxshowdocs=1; my $n="\n"; my $db = $S->GetDatabase($SERVER, $mailfile); my $docs=$db->Search( "Form = \"Appointment\"" , $DT, $maxdocs); # "Ap +pointment"(calendar) or "Memo"(email) my $count = $docs->Count; print "found ",$count," docs.\n\n"; for(my $i=1;$i<=$maxshowdocs and $i<=$count ;++$i){ print "############## Document $i ###################\n\n"; my $doc=$docs->GetNthDocument($i); my $items=$doc->Items; foreach my $item (@$items){ my $name=$item->Name; my $type=$item->Type; print "ItemName: $name / ItemType: $type"; my $val; if( $type==1024 ){ # Type-Value for DateTime Type my $dtarr=$doc->GetItemValueDateTimeArray($name); print " [", scalar @$dtarr," value(s) in Item]"; print " (DateTime) "; foreach my $dtelem (@$dtarr){ if( $name=~/Range$/ ){ # DateTime or NotesDateRange? ***** $val .= ($dtelem->{StartDateTime}->{LocalTime})." - ". ($dtelem->{EndDateTime}->{LocalTime})." "; }else{ $val .= ($dtelem->{LocalTime})." "; } } }else{ $val=$doc->GetItemValue($name); print " [", scalar @$val," value(s) in Item]"; $val=join($n, @$val); } print "$n$val$n$n"; } }

Update: Added smartass comment as first sentence. ;-) Made first sentence into a new and improved first paragraph.


In reply to Re: Notes::OLE: Doc-Dumper? by mhi
in thread Notes::OLE: Doc-Dumper? by mhi

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, 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.