Solved

Deleting ALL attachments to a Lotus Doc with VB

Posted on 2000-03-10
2
372 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
  • 2
2 Comments
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 100 total points
Comment Utility
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
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

728 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

9 Experts available now in Live!

Get 1:1 Help Now