Re: In Outlook add a folder then move a message to it.

From: Mike Gagnon (mgagnon23_at_hotmail.com)
Date: 01/03/05

  • Next message: Fred Taylor: "Re: Memo Field in Report vfp 6 ?"
    Date: Mon, 3 Jan 2005 05:28:39 -0500
    
    

    This will give you the folder ID number (the value i). Folders a usually
    numbered by creation. So if you had 11 folders and you create a new one, it
    would normally have the ID #12

    CLEAR
    ON ERROR *
    Local oOutlookObject,olNameSpace
    #Define olFolderInBox 6
    oOutlookObject = Createobject('Outlook.Application')
    olNameSpace = oOutlookObject.GetNameSpace('MAPI')
    oItems= olNameSpace.Folders(1).folders
    FOR i = 1 TO 13
    ?'Folder Name: '+olNameSpace.Folders(1).folders(i).name, ', ID number:
    '+trans(i)
    ENDFOR

    "Dorian Chalom" <DChalom@Comcast.net> wrote in message
    news:OTojDeT8EHA.2572@tk2msftngp13.phx.gbl...
    > Hi Mike!
    >
    > Glad to hear from you. Since I can no longer log into Tek-Tips.
    >
    > I am recieving an error message of "unknown COM error code" on the Move
    > statement of the following code. Is there a way for me to determine the
    > folder number of a folder?
    >
    > Thanks for any insight you can give and
    > A Happy New Year!
    >
    > loMSend = oOutLookObject.CreateItem(0)
    > m.Emp_eMail = tdbDoc.Emp_eMail
    > loMSend.Recipients.Add(m.Emp_eMail)
    > loMSend.Subject = tdbDoc.Subject
    > loMSend.Body = tdbDoc.DocText
    > DO WHILE tdbDoc.Emp_eMail = m.Emp_eMail .AND. .NOT. EOF("tdbDoc")
    > IF lFwdDoc
    > IF .NOT. ISBLANK(tdbDoc.DocFile)
    > loMSend.Attachments.Add(tdbDoc.DocFile)
    > ENDIF
    > ENDIF
    > SKIP IN tdbDoc
    > ENDDO
    > loMSend.Send()
    > IF lOLSave
    > * Find Folder
    > lFound = .F.
    > oFolders =thisform.OLGetFolder(cOLSaveFldr)
    > oFolders =oFolders.folders
    > FOR EACH oFolder IN oFolders
    > IF cCase = oFolder.Name
    > oFldr = oFolder
    > lFound = .T.
    > EXIT
    > ENDIF
    > ENDFOR
    > IF .NOT. lFound
    > oFldr=oFolders.Add(cCase)
    > ENDIF
    > loMRead.Move(oFldr)
    > ENDIF
    > loMRead.unRead = .F.
    > IF lDelete
    > loMRead.Delete()
    > ENDIF
    > RELEASE loMRead, loMSend
    >
    >
    > "Mike Gagnon" <mgagnon23@hotmail.com> wrote in message
    > news:eMqzxnN8EHA.3820@TK2MSFTNGP11.phx.gbl...
    >> It may be just a case of your syntax, but I have had success with this
    >> (After having determined the index number of the folder I want the
    >> message to be to)
    >> This example moves the unread message to the folder that has an index of
    >> 12.
    >>
    >>
    >> Local oOutlookObject,olNameSpace
    >> #Define olFolderInBox 6
    >> oOutlookObject = Createobject('Outlook.Application')
    >> olNameSpace = oOutlookObject.GetNameSpace('MAPI')
    >> oItems= olNameSpace.GetDefaultFolder(olFolderInBox).Items
    >> For Each loItem In oItems
    >> If !loItem.unRead
    >> loitem.Move(olNameSpace.Folders(1).Folders(12))
    >> Endif
    >> Next
    >>
    >> "Dorian Chalom" <DChalom@Comcast.net> wrote in message
    >> news:uRvEGS47EHA.3856@tk2msftngp13.phx.gbl...
    >>>I am trying to figure out how to determine if a folder exists in Outlook.
    >>> If it does not exist then create it.
    >>> And either way then move the current message to that folder.
    >>>
    >>> Currently i have it workuing through the creating a folder if needed,
    >>> but i cannot get the Move to work.
    >>>
    >>> Please,
    >>>
    >>
    >>
    >
    >


  • Next message: Fred Taylor: "Re: Memo Field in Report vfp 6 ?"

    Relevant Pages

    • Re: database - table references (VFP9)
      ... if the data environments init method was called before any ... it first looks in the folder where the tablewhere placed ...
      (microsoft.public.fox.programmer.exchange)
    • Re: Using external libraries (.lib files) in VFP
      ... Run it with an integer as parameter and it returns the folder name. ... Endif ... > Do you mean that I have to register the functions before calling them? ... >> API calls from VFP can be rather a bit difficult. ...
      (microsoft.public.fox.programmer.exchange)
    • Re: loMRead.Move(oFolders.Folders(cCase))
      ... > Trying t o move one message from the InBox to another folder in Outlook 2002 ... > ENDIF ...
      (microsoft.public.fox.vfp.forms)
    • Memstick storage driver in Release and debug mode
      ... I wrote MemoryStick driver for CE5.0 and its working fine in debug ... While trying to create new folder one small window pops up and shows ... I m not getting any debug messages written in DSK_IOControlfunction ... ENDIF BSP_NOMEMSTICK! ...
      (microsoft.public.windowsce.platbuilder)
    • Re: list subject
      ... With the e-mail volume I pull, having everything coming into a single folder is impossible ); I organize by folders, and kmail allows some really slick presentation of those folders, and does the automatic List-Id based filing. ... I see you're using Thunderbird on Windows, which I am in process of configuring at this moment on a new laptop. ... When new messages come in, I merely press the 'n' key to get to them, or, I've added the 'Next unread message' and 'Previous unread message' buttons to the toolbar so I can mouseclick to them; additionally, I've changed the behavior where it continually asks you if you want to go to an unread message in the next folder by doing the following from Thunderbird tricks and tips: ...
      (Fedora)