Moving a doc into another folder using VB6

Hi Experts, well I got the code to read the inbox using VB
(http://www.experts-exchange.com/Applications/Email/Lotus_Notes_Domino/Q_21830123.html)
, 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
 Wend

-----------------------------------------------------------------------------------

any help is always welcome


edwbear1976aAsked:
Who is Participating?
 
marilyngConnect With a Mentor Commented:
Hi edwbear1976a,
> "($TrashCain)"
"($Trash)"  Is the correct folder, and the sytax is

with docBefore
   .putinFolder "($Trash)"

Regards!
0
 
mshogrenConnect With a Mentor Commented:
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?
0
 
edwbear1976aAuthor Commented:
Hi Experts and thanks for your advices
Mshogren:
<<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
ed
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

 
marilyngConnect With a Mentor Commented:
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

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

end sub

0
 
edwbear1976aAuthor Commented:
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
=======================================
'Code
   
If Err.Number > 0 Then 'at the bottom
            MsgBox Err.Number + " " + Err.Description
            Err.Number=0
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  
0
 
edwbear1976aAuthor Commented:
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?

Thanks

Ed  


====================================
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

====================================
0
 
mshogrenConnect With a Mentor Commented:
The problem may be that you are using hidden folders like ($WebOpt).  Try using a folder name like "Test" without the brackets.
0
 
marilyngConnect With a Mentor Commented:
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.



0
 
edwbear1976aAuthor Commented:
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...
0
 
edwbear1976aAuthor Commented:
===========
0
 
edwbear1976aAuthor Commented:
==========
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.