Solved

Deleting ALL attachments to a Lotus Doc with VB

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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need a tweak in Column code (in Notes view) 5 60
Lotus Notes and SQL Server 2008, ODBC 22 1,346
How do I delete a user in IBM Lotus Notes 2 203
Notes > Exchange calendar issues 5 64
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 Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

773 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