[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Deleting ALL attachments to a Lotus Doc with VB

Posted on 2000-03-10
2
Medium Priority
?
383 Views
Last Modified: 2013-12-18
I have a project that requires me to delete ALL attachements (and their
associated fields) from a Lotus Notes
Document.  How can I do this in VB 6.0.

I am thinking something like this:

Dim objRetval  as Object

' Where objDoc is predefined as a lotus notes document object

Set objRetval = objDoc.GETFIRSTITEM

Do While Not objRetVal is Nothing
      
      If objDoc.HASITEM(objDoc.GETFIRSTITEM) then call objDoc.RemoveItem(objDoc.GETFIRSTITEM)
      Set objRetval = objDoc.GETFIRSTITEM

Loop


The point is that I dont care about the
names of the attachements.  If a doc has
ANY attachments, I want them ALL removed.

Furthermore, I want the Lotus Note's
fields that hold these attachments
deleted too, without having to NAME
each specific item.



0
Comment
Question by:Zevick2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 300 total points
ID: 2607119
Hi

Are the attachments made in a richtext field or Form?

Use NotesForm object to retreive fields and check the each type for Richtext and in turn check whether it has got any attachment, if so delete the field.

Here is how the code looks
===========
Dim session, db As Object
Dim items, docCol, doc As Object

Set session = CreateObject("Notes.NotesSession")
    Set db = session.GetDatabase("servername", "test.nsf")
     
set docCol = db.AllDocuments
set doc = docCol.GetFirstDocument
while doc is nothing
  set items = doc.Items
  For Each item in items
   If ( item.Type = RICHTEXT ) Then
   For each o In item.EmbeddedObjects
   If( o.Type = EMBED_ATTACHMENT ) Then
     Call item.remove
     Call doc.Save(true,false)
    End If
   next
   End If
   End if
  Next
Wend
===========

I din't have time to test the code, If you have any concerns let me know.


Good Luck
~Hemanth
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 2607122
Hi

Ignore the statement above the code, Since you are passing thru doc, there is no need for forms. sorry about that

~Hemanth
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
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.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

649 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