Solved

Lotus Notes Get entire text of New Document including the Parents

Posted on 2013-12-10
17
677 Views
Last Modified: 2014-12-13
In the email application, user selects an existing email in the INBOX folder.
The chooses REPLY, this opens a NEW document.  I need to extract the ENTIRE text from the NEW Document prior to sending to check for bad words.  
I can get the current text for the NEW Body, Subject and Attachments just fine.  But I am unable to get the REST of the NEW Document that I can see with my eye balls.  

I have tried many things, the closest that I have come is using doc.GetItemValue("$Abstract")(0), however this only returns the first 100 chars of the FIRST Parent.
How can I extract the ENTIRE text?  I don't care if it is ugly, at this point.  Also, I am unable to SAVE the new document as my code runs in the QuerySend() Function of the REPLY Form.  I know some have suggested saving the document.  I get an error about nesting.

Thank you in advance.  I know someone has done this before.
0
Comment
Question by:appliancedude
  • 9
  • 7
17 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 39709334
IMHO you'd better check the mails "after the fact", i.e. after the user clicks SEND but before the mail is sent out by the server. That's how most outgoing anti-spam applications work. Would that be an idea, i.e. to use the Extension Manager features, and prevent the mails from leaving your mail server??
0
 
LVL 1

Accepted Solution

by:
appliancedude earned 500 total points
ID: 39710490
Thanks sjef_bosman, I don't have access to the servers so I can't do that.  Also this is only for about 1% of users in the company, so I would need additional logic there (doable though)
As usually happens, you post a question early in the morning and you find the solution if you work at it long enough.  
So I found a little gem called "fwdID", an environment variable that sits in an "ini" file!  I didn't know anyone used ini files anymore, well at least non-xml settings files.  
This gets set in every "action" that makes a reply document.  So my function gets called by the 3 email forms in the QuerySend() sub.
The new function looks up the "fwdID" as it contains the ParentID for the new document.You do not have to save the new doc!

myBody contains the ENTIRE text of the NEW email AND the Parent Document Text also

Code:
        Dim myParentID As String
      Dim myDB As NotesDatabase
      Dim myParent As NotesDocument
      Dim mySession As New NotesSession
      Dim myBody As String
      Dim myRTItem As NotesRichTextItem

        Set myDB = mySession.CurrentDatabase
        myParentID = Mid(mySession.GetEnvironmentString("fwdID"),3)
      Set myParent = myDB.GetDocumentByID( myParentID )
      Set myRTItem = myParent.GetFirstItem( "Body" )
      myBody =  myRTItem.Text + source.FieldGetText ("Body")

Now on to something else...
0
 
LVL 1

Author Comment

by:appliancedude
ID: 39711401
I've requested that this question be closed as follows:

Accepted answer: 0 points for appliancedude's comment #a39710490

for the following reason:

I found the better solution.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 39710714
Better solution? That's a matter of opinion... It may work now, but it's undocumented so it may work now but it could be changed in the future. I suppose there are situations where fwdID contains an id of a mail that has got nothing to do with the current mail.

All in all: I'd never approve your code. But: it's your show! ;-))
0
 
LVL 1

Author Comment

by:appliancedude
ID: 39711403
No one cares about your approval.  I'll give you the points for providing a general top-most level direction devoid of detail.   My solution IS better FOR ME, perhaps not others.  I DO agree that the "best" way to do this is on the servers if absolute security is required AND you have the AUTHORITY to jeopardize 100K users emails (I don't and do not care to).  If this was corporate-wide, I would expect they would have someone other than an appliance repairman creating it.  The user certainly has the option of editing their own mail template.
The code is self documenting.  Am I wrong (i could be) that the entire email template is "undocumented".   I see all kinds of solutions where they "save" the document and perform all kinds of acrobatics, I have never found where they used the fwdID anywhere on the Internets.  fwdID  is not some hidden undocumented thing, it is simply a sloppy way that IBM uses to keep track, so I assume they know best ;)  So yes, my solution is unique, simple, works and most importantly ...FINISHED!
I have developed on Lotus notes exactly ZERO minutes before today.  Lotus Notes can do anything, I get it, but it allows the sloppiest coding possible, the best example is the Mail templates that IBM wrote themselves.  By the way I created my own environment variable, as you are correct one never know when that one will be pulled out or not get set at some point, but it was always next to the one I created.  I don't think I have utilized an INI file since the 90's, but that is exactly how IBM keeps track of the parent document for a new one.  yuk.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 39711832
No, you're right, my approval is irrelevant and of no value.

It's the eternal dilemma of a developer: find the "appropriate" solution, making sure that all the elements in the equation are more or less in balance (time, cost, risks, RoI, TCO, user satisfaction, job security, legal requirements, etc.). And judging from the way you describe it you just did a heck of a job:  without prior experience (really?) you found the fwdID environment variable (which I could never have suggested), and you used it or a similar one to get the information you needed. Problem solved.

Very often, there is more to a question that just the solution. I thought that it was the case here: a quick solution now, which might lead to leading to huge problems when applied. I should have been more careful with my wordings. I should also have asked about the scope and the impact of the problem. I'm sorry I didn't. I assumed once more...

All I intended to say is that you're taking a considerable risk IF the solution is spread out over an entire organisation. The mail template is a tricky thing, it's owned by IBM, and every release brings new features or improvements. If you modify the mail template, and you intend to install all Notes/Domino Fix Packs on the servers when they are released, bugs in earlier versions won't get solved unless you do everything to document your modifications, so they can easily be reapplied when you're no longer working there. I personally never change the mail template. Correction, I did it for one of my clients, but the thing we build is completely separate from the rest, rather well-documented and can be copied easily to a newly released template. Still, I'm not really proud of it.

I searched the web for other occurrences of fwdID, and I found some, but indeed not many. I think you deserve all credits for having come up with a good solution, for your case. I intend to ask a Moderator to change the Accepted Solution to the one you intended to accept.
0
 
LVL 1

Author Comment

by:appliancedude
ID: 39712888
I agree, I was not clear that it was for only 1% of the entire organization and this little project has no $$ left.  So yes, cheap, dirty and fast.  Also this organization is dropping Notes within a year...yep trashing the whole thing after what must be 15-20 (can that be right?) years.  So I imagine there will be some work for folks like you to migrate legacy stuff from notes to Sharepoint/SQL/Exchange etc.  Yes, they are going MS all the way.
Yes, I really only started this a day ago because.. get this..the IBM Notes support forums were shut off for an entire 3 days for maintenance, yes just when I set aside time, nothing!.  How professional!  I know VB in all it's flavors very well, so the LotusScript clone is no problem for me.  I bet we could talk for hours about Notes, I am seriously intrigued by its staying power...once you peek under the covers, you can't get that vision out of your head!   If you can't be good, be lucky or snuggle up to the government really close.  I don't want to be just another Notes hater, but dang they give me so many reasons.  Man I have so many examples...ok here is one...shared actions..so like if they are so shared why are the so MANY of them in the mail template!!  Reply, rt click Reply, Reply (for internet) and the list goes on and on.  Is it me? So many things that "don't always work" , variables that "are not available here" ..events that "fire out of order"  
Having said all of that...I could retire migrating notes databases....I can do slop.  lol
Keep the points man, one day you will be God of Lotus!!
Thanks for weighing in, it is people like YOU that make this thing work!
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 39712970
Oh, what a shame! No it's not folks like me who help migrating away from Notes, I don't want to burn my fingers on projects that are only meant to dump Notes for no good reason. Migrating to M$ is pointless. Why not move (not migrate) to XPages? What is the requirement? Do they really know how much money they're going to waste? Boy, for half the $$ required to migrate I'll tidy up all databases and make sure it runs like Swiss watches. It's often the Admins who made a real mess of the Domino environment.

The huge problem for us Notes developers is that IBM isn't making enough marketing noise, so everyone has the perception that "Notes is dead". By the way, I have heard that had that for the last ten years or so, and it's still there. And now, with releases 8.5 and 9, XPages, the interconnectivity, sheesh, they really don't know what they are throwing away. It's often a CIO decision, a nitwit who knows bothing of Notes, who doesn't understand groupware end collaboration. I think I now I hate people who hate Notes. Sadly, in the majority of these cases they hate it because nobody explained what Notes is about. Another "fact" (can't prove it myself): you need twice as many Admins to run an M$ environment that's compared to a functionally equivalent Domino environment.

Notes is meant to optimize the work of an entire organisation. M$ stuff is meant to do local optimisation. And what you often see is that a set of optimal sub-systems forms a sub-optimal system, whereas a set of sub-optimal sub-systems together is the optimal system. That's the idea of Notes: give everyone 80% of what they need (they still want the other 20% though) and the whole organisation is informed. In the M$ view, all departments get their perfect solution, but what's the result? The Administration department can no longer see the Sales actions, Sales has the perfect CRM but other departments aren't informed, Management gets different reports from different departments, because the synergy is low.

Here's my prediction:
- synergy will decrease
- the migration project will last 40% longer
- it will cost 50% than budgeted
- the predicted ROI will never be met (and will even be negative)
- the TCO will increase

Am I a pessimist? Maybe, but I still have to see the first M$ success story corroborated by facts and figures of a successful migration, i.e. one that yielded a lower TCO within a few years. But don't hesitate to prove me wrong!!

And thanks for the kind words.. :-)

PS Shared actions? I never use them ;-) Peek under the covers? Don't try that with SharePoint either... Other mishaps? Well, Notes never lost a single mail at the White House...
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Author Comment

by:appliancedude
ID: 39713987
I have been with this org for 25 years, we never did get the synergy thing right.  The problem always was that the shared systems (help desk/monitoring/email/groupware) is assigned the standard team.  Team consisting of one person with the development talent, his untalented supervisor and their manager who is just waiting for retirement. In the beginning they are clear that WE are the customer.  It seems to take just about a year when they decide that THEY are the customer and you are bothering THEM with your silly requests.  They make it a hassle to deal with them so you just go away...like rebates from Chinese companies.  You do something with what you have control over, an access database, an excel spreadsheet...whatever and mail that thing around or share it if you know how.  In my case 17 years ago when our help desk refused to provide the reports that we required in electronic form (they printed them out!!), I did just that, I created a web-based trouble ticket system with inventory and full life-cycle equipment maint tracking...before Remedy.  So much for leverage and synergy.  The interesting thing about sharepoint (not a huge fan yet) is that everyone gets their little space that they can allow others instant access to by just sending them a link.  By the way my little "bad word" task needed to give the user the chance to "send it anyway", another reason why easier to put it right in the UI.  For synergy to work, I look at real life examples such as Standards groups and say Ebay compared to Craigslist.  I would say what makes them work is a HUGE investment in the TEAM that administers the system.  With little investment and no oversight (and periodic review) of the team, you end up with craigslist...or if you are old enough..CB radio..which both are crap given enough time.  I can only fix my little part of the system.
Thanks for putting up with my bad attitude!  :)
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 39714109
At least you have the helicopter view. It'll be hard to maintain that view  when mushroom development commences... i.e. small applications will pop up everywhere, some are interesting, some taste really well, but look out for the poisonous ones!
0
 
LVL 1

Author Comment

by:appliancedude
ID: 39714265
True, one more thing lotus...a brief look at some of the servers shows the 20 year history of tiny forgotten databases....hundreds that attempt to do the same things...Bobs Inventory /Freds Inventory system / Request a laptop / Request a cell phone / blah blah blah...
Very little synergy or reuse there, a gaggle of forgotten old apps...was that a tumbleweed?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 39714624
The "advantage" of moving off of Notes is that all those small mushroom applications will disappear "overnight", while they can say that "the decision is not ours, because 'they' told us that we have to migrate". Since peeps understand that complaining is futile in this case, they don't, and they accept the fact that they now have to live without their private Inventory system. Politics...

It could be done differently and lots cheaper, e.g. by a CIO who isn't afraid to confront his users with difficult decisions. All he needs to do is tell them that you intend to do some spring cleaning of your servers (for example the springs from 2002-2006, to start with ;-)) and that all databases that are considered useless shall be archived, in a month or so. That gives everybody the time to make a local replica of his favourite toy, so he can still do the things he was used to.

I'd love to sell you a Notes Makeover project, but I take it that the decision has already been made, plus I suppose you're not really next-door to me. Greener pastures and all that... Yeah, right...
0
 
LVL 1

Author Comment

by:appliancedude
ID: 39714819
Too many many many years of neglected notes ...something... not sure what it was ...administration...configuration?  Who knows.  For example we went years where everyone was using the mail file on the servers, then we were very nicely asked to create a local replica to make lotus start in less than 20 minutes..but again asked nicely and not sure how many actually did that (I didn't).  Everything that they asked the users to do to help was contained in a very long, convoluted instructional email with buttons placed in non-standard places that we weren't sure if we should click or not, no confirmation that the click actually did anything.  Combine this with overly zealous use of highlighting and bolding and various sized fonts...we DREADED having to mess with anything Lotus.  Finally we were limited with severe quotas that have not increased in 10 years!  Can you imagine the cost of the storage and memory back then compared to now...and STILL kept back to a quota where simply emailing my new template threw my boss over his quota, so he can not keep it in his inbox for a second without losing the ability to send mail.  Bad bad bad operation of the whole thing...I think we were even a partner with IBM at some point...but even then, no (like you say) marketing to us the end users at all.  No excitement, only dread.
They let this patient limp along for way to long..too little too late.  Yes I see all the "new" things that they have added (web services etc) but to be honest, it feels like an auto manufacturer that boasts "Now with POWER WINDOWS!!" (I was going to say heater, but that would be simply mean lol)  I really don't want to be that hater, but the whole experience was not presented elegantly for me. For their sake I hope it is not too late.  But for us, it is game over...someone in my generation was probably promoted to a place where he can say "buh bye" to notes.  We will be all up in MS in about a year.  This has to be a huge loss for IBM (80-100K users)  You mentioned the white house, so perhaps we are near each other after all!
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 39715350
Somehow I lost the text i typed... I mentioned the White House for the story of millions of lost mails, after migrating from Notes to Exchange. See http://blog.proofpoint.com/2009/12/migration-from-lotus-notes-to-microsoft-exchange-lack-of-automated-email-archiving-lead-to-22-million-lost-bush-emails.html

Please allow me to send you a mail a year from now, just to ask you about the progress you made, if any, in migrating away. Ludicrous, one year... No flippin' way!
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 39715356
Oh, yes, indeed, beware when the system admins start to think that they run the business, and that they know what's best for the organisation and the users. They need to be replaced by admins who really understand how to be of service to the people who are responsible for revenue generation. There is no excuse for incompetent admins. Dixi.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 40497719
Hi Dude,

Of course I made a note of my promise (in Notes for sure). I'm dying to learn how green your new pastures are by now...

Regards, Sjef
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Resolve DNS query failed errors for Exchange
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
The purpose of this video is to demonstrate how to set up a Mailchimp campaign. This will include styling and adding elements to a newsletter/email. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchim…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now