Solved

Deleting ALL attachments to a Lotus Doc with VB

Posted on 2000-03-10
2
378 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

724 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