Moving a doc into another folder using VB6

Posted on 2006-05-09
Last Modified: 2013-12-18
Hi Experts, well I got the code to read the inbox using VB
, it's for an account created only for that purpose and  I got manager rights over it, but I need now  to make a process that all incoming mails once are readed and transformed to a Pdf , to put theninto another folder and then to remove them, but it seems like its not working

so I was doing this
While Not doc Is Nothing
    If doc.Form = "Memo" Then
        Set rItem = doc.GetFirstItem("Body")
              CreatePdfDoc(rItem.Text) ' my own sub to create a pdf
         With rItem
       End With
    End If
    Set docBefore = doc ' I set an object and reference it to move it
    Set doc = view.GetNextDocument(doc)

        With docBefore
            .PutInFolder "($TrashCain)", True  ' Testing Purpose  
            .RemoveFromFolder "($Inbox)"   '
        End With


any help is always welcome

Question by:edwbear1976a
    LVL 15

    Assisted Solution

    Are you receiving any errors?  Where does it fail?

    Is the ($TrashCain) folder created?  It may be hidden but you can still see it in Domino Designer.

    Are the documents getting put in this folder?
    LVL 18

    Accepted Solution

    Hi edwbear1976a,
    > "($TrashCain)"
    "($Trash)"  Is the correct folder, and the sytax is

    with docBefore
       .putinFolder "($Trash)"


    Author Comment

    Hi Experts and thanks for your advices
    <<Are you receiving any errors?  Where does it fail?
    Nope, I don't receive any errors, I would like to recieve it to know where it fails
    <<Is the ($TrashCain) folder created?  It may be hidden but you can still see it in <<Domino Designer.
    well I don't know if the method created that folder with I never meant to creat a folder TrashCain , with that name I just meant the "Trash Folder" that already exits

    marilyng :
    >>> "($TrashCain)"
    >>"($Trash)"  Is the correct folder
    thank you,I was writing it wrong, that's why when I checket the Trash Folder I didin't see anything in it.

    >> and the sytax is

    >>with docBefore
    >> .putinFolder "($Trash)"

    Well  I referenced the Notes Library in my proyect  to know about the putinfolder method and to know about its parametters but  it says that there was another parameter that commands to create a folder in case that folder name doesn't exist.. that's why you see a boolean value..but anyhow it didn't work at all so I didn't see new folders creates .. I will follow your advice
    Thank you very much, tomorrow morning I will test it in my job
    LVL 18

    Assisted Solution

    If you put it in the trash folder, then it will be deleted, right?   whether or not you can create the folder in the mail file with the "true" parameter depends on your access to the mail file.

    To see if it is running with errors, turn on debug mode and then run the agent.  If there is an error, the agent will stop at the error.

    Also you can trap errors with:

    On error goto Handle_Error

    then add at end end of your sub:

    'rest of stuff, but add an exit so your script doesn't run into your error routine...
    Exit sub

      on Error goto 0
      msgbox "There was an error: " + error$ + "-" + str(err)
      exit sub

    end sub


    Author Comment

    Ok ,thanks for the comments
    well I 'm testing it right now  with my own account (the mail box of the account over I got full privileges  is empty now) with mails that are stored in the inbox (important mails  are always moved  to another folder before ) so they  are junk emails to me...

    well for handling errors  I often use "On error resume next"  insteado "Goto" so that allows the application to move on  and in the end It debugs it instead of scaping it

     On error resume next
    If Err.Number > 0 Then 'at the bottom
                MsgBox Err.Number + " " + Err.Description
    End If

    (I remember my Teacher always said that he was fully against the "Go to instructions".. well so maybe he was right or wrong)

    but as I don't get messages this way I will try your way...

    Thanks for your comments, I'm sure now it will work fine , I'm gonna try it right now  

    Author Comment

    Hi Maryling , thanks  for your comments ,it did work .. I mean it was  moved into the Trash box and then it was romoved .. but then I created a simple folder "WebOpt"  and I tried to do the same and it didn't move anything ... it was removed  but not moved....
    so I guess I 'm missing something.. maybe is it about the folder properties? or something?



    With beforeDoc
    .PutInFolder "($WebOpt)"  ' if it's moved well I can't see it
      .PutInFolder "($Trash)"  ' it's moved, works fine
       .RemoveFromFolder "($Inbox)"  ' works fine
    End With

    LVL 15

    Assisted Solution

    The problem may be that you are using hidden folders like ($WebOpt).  Try using a folder name like "Test" without the brackets.
    LVL 18

    Assisted Solution

    The last call is to trash, which would remove it from all other folders.

    Your instructor may have been correct, but error trapping cannot be universally applied.  ON error resume next is not a good thing to do, for the most part.  You need to trap the error and decide if it's safe/prudent to "move next"  else you end up in a loop, or crashing the server, or your code not working at all because it's skipping the errors that you need to know about.


    Author Comment

    Hi mshgren, it did work fine, yeah thanks...
    thank you marilying for your last comment and for all your help indeed
    well now It's time to split points but first I gotta increase them...
    Thank you guys...

    Author Comment


    Author Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
    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…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    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…

    761 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

    12 Experts available now in Live!

    Get 1:1 Help Now