Solved

Deleting ALL attachments to a Lotus Doc with VB

Posted on 2000-03-10
2
377 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 100 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Lotus notes email code 2 131
Lotus Notes shared mailbox 'Sent by' in header 3 154
DNS error assumed 8 106
Replace Database Design 5 15
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 users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

737 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