Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 646
  • Last Modified:

Creating hyperlinks to local documents in a memo body w/LotusScript?

We're trying to write some code that walks through a user's e-mailbox, detaching any file attachments, removing them from the mail, and replacing them with "hyperlinks" to the physical location of the file.  This will save server space while still allowing users to access their attachments as if they were still attached to the mail.

I've got the code written to do the removal of the attachments, but can't seem to get the hyperlink stuff working.  Anyone have suggestions on how to create a hyperlink through LotusScript?

This is on 5.08 on a Win2k platform.

Dave
0
Moonshadow
Asked:
Moonshadow
  • 5
  • 4
  • 3
1 Solution
 
CRAKCommented:
Have you considered "shared mail"?
0
 
ArunkumarCommented:
Shared mail wont solve the purpose since if any one of 10 recipients does not delete the mail then the server space is eaten like hell.

I guess i have a simpler solution.  I just am hunting for it.  Hang around.

:-)
Arun
0
 
MoonshadowAuthor Commented:
Don't lose too much sleep on this.  It's more of a pet-project sort of thing than anything needing immediate help.

Though I do appreciate the assistance!

Dave
0
Industry Leaders: 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!

 
ArunkumarCommented:
I got it, send me your email id let me forward that to you !

:-)
Arun
0
 
MoonshadowAuthor Commented:
You can send to david_lundy@shepherd.org.

Thanks 'mate!
0
 
ArunkumarCommented:
Anytime buddy !

Removing some contents from the db as it may not be applicable to you.

:-)
Arun
0
 
ArunkumarCommented:
Its on the way.....
0
 
MoonshadowAuthor Commented:
Well, after serious work, it appears that this is an issue that just can't be solved.  The Notes client appears to not be able to display HTML code in its documents, although the web-client can.

Thanks to Arunkumar for all the help working with this.  You really put a lot of time into something that you didn't have to.  I very much appreciate it.

Dave
0
 
CRAKCommented:
Arun,

You were right about shared mail, but depending on the solution I can't see the difference to detaching/linking if an attachment was sent to several people.

So I'm curious:

How did you solve deletion of attachments after deletion of the message? Are you keeping track of who deposited which attachment?
Are you storing attachments local (C:) or on a mapped drive? I never realy thought of a local drive....!
And what about duplicate filenames?

I don't need the code: I only find it interesting to know how certain problems are tackled.
0
 
ArunkumarCommented:
Well,

Dave and i were discussion across emails and trying various solutions, he understood the complexity at one stage and he said let the work be done manually by all the users and the hyperlink was avoided all they have decided it to detach the file from the email and put a path in that place where they could find the actual file in their hdd, pretty much workload for the users but Dave concluded that they have to live with it.

:-(
Interestingly he has offered me points for discussing with him across mail.
:-)
0
 
CRAKCommented:
I already had a feeling that this could be even harder than it seemed!
Should I send him a mail to, you think?

Just joking Dave! ;-))

One remark for you though:
I don't know about the knowledge level of your users, but some of mine would certainly link to files in their own C-drive, wondering why other's can't open the link....
Make sure everyone understands: decisions like that might backfire on the helpdesk!

Good luck!
0
 
MoonshadowAuthor Commented:
Well, here's the rub:

We've got some users here that have 600-700Mb mail files chocked full of attachments.  They claim that they cannot remove the attachments from their mails because a) there's too many, b) they need to store them all for reference, and c) they need to know who sent which attachment when. However, they're soaking up a boatload of our server space.

As an alternative, we're proposing to remove each attachment from the user's e-mail, save it on their shared Netware drive (which has a huge amount of HD space), and replace the attachment with a link to that document.  This allows the users to maintain their mail file exactly as it is now, but without the sizable attachments. T'would be much better.

I'd already written the code that walks through their mailfile and detaches/removes the files.  The problem I'd had was creating the doclink/hyperlink back to the document.  However, the Notes client doesn't seem to be able to handle hyperlinks well.  The only solution I can find is to replace the attachment with a text line stating where the file was detached to.  It's servicable, if not terribly elegant.

I've attached my code here so you can see what I'm talking about.  I suggest you don't run it on a live mail database until you see how it works.  :)

===========================================================

Sub Initialize
  Dim uiws As New NotesUIWorkspace    
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim view As NotesView
  Dim doc As NotesDocument
  Dim rtitem As Variant
  Dim fileCount As Integer
  Dim filename As String
  Dim ext As String
  fileCount = 0    
     
  Set db = session.CurrentDatabase
  Set view = db.GetView ( "($All)" )
  Set doc = view.GetFirstDocument
     
  While Not ( doc Is Nothing )
    If ( ( doc.form (0) = "Memo" ) Or ( doc.form (0) = "Reply" ) ) Then
      Set rtitem = doc.GetFirstItem ( "Body" )
      If ( Not ( rtitem Is Nothing ) ) Then
        If ( rtitem.Type = RICHTEXT ) And ( doc.HasEmbedded ) Then
          Forall o In rtitem.EmbeddedObjects
            filename = Left ( o.Source, Len ( o.Source ) - 4 )
            ext = Right ( o.Source, 4 )
            If ( o.Type = EMBED_ATTACHMENT ) Then
              If ( Dir ( "C:\attachments\" & filename & ext ) = "" ) Then
                Call o.ExtractFile ( "C:\attachments\" & filename & ext )
          filename = "C:\attachments\" & filename & ext
              Else
                If ( Dir ( "C:\attachments\" & filename & " - " & fileCount & ext ) = "" ) Then
                  Call o.ExtractFile ( "C:\attachments\" & filename & " - " & fileCount & ext )
            filename = "C:\attachments\" & filename & " - " & fileCount & ext
                Else
                  fileCount = fileCount + 1
                  Call o.ExtractFile ( "C:\attachments\" & filename & " - " & fileCount & ext )
            filename = "C:\attachments\" & filename & " - " & fileCount & ext
                End If
              End If
              Call o.Remove
           Call rtitem.AppendText ( "File detached to: " & filename )
              Call doc.Save ( True, True )
            End If
          End Forall
        End If
      End If
    End If
    fileCount = 0
    Set doc = view.GetNextDocument (doc)
  Wend
End Sub
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 5
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now