Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create Delete folders in Outlook Automation
Message
From
16/04/2010 18:39:00
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01460596
Message ID:
01460689
Views:
24
thanks for the research Naomi. I remember the '=' issue from another problem that i had been working on months ago. Didn't seem to solve the delete folder command though in this case.

I am actually more interested in your suggestion. I understand the logic, but can't seem to get it to work within the context of the codes laid out below - i've experimented with different places and odd things happen. Getting this command somehow tied in with only unread inbox items is problematic since the overall command given is to sweep through 'all' emails - so the 'next' may not in fact be an unread.

i may simply end up leaving the temp folder there and solve the problem this way if i can't make headway.

thanks for the help
k


>Pseudo code
>
>for lnI = loInBox.Items.Count to 1 step - 1
> loMsg = loInbox.Items[m.lnI]
> ...
>next
>
>Also I found this message in the meantime
>Re: Outlook Delete stop working Thread #839827 Message #839838
>
>may be this can help?
>
>>Sounds like a solution Naomi - i'm a little confused as to where i would stick it. my initial path is going through 'all' emails and sifting through the unread via 'if' command. would i somehow insert your clause into the 'if' area or include it in the nitiatial the search for 'all' emails?
>>
>>For Each loMSG In loInBox.Items
>>    If loMSG.UnRead
>>    && do something here
>>    endif
>>endfor
>>
>>for lnI = Messages.Count to 1 step -1 && where would this go?
>>next
>>
>>
>>>I'm thinking you may have an error in your logic and that's why the e-mails are missing.
>>>
>>>Try using
>>>
>>>for lnI = Messages.Count to 1 step -1
>>>next
>>>
>>>loop, e.g. do it backwards.
>>>
>>>>good idea! - alas niether worked
>>>>loNameSpace.Folders("Personal Folders").Folders.Remove('TempBox')
>>>>loNameSpace.Folders("Personal Folders").Folders.Delete('TempBox')
>>>>
>>>>Perhaps there is a better way to deal with the problem i'm trying to overcome. Here is problem: When i move emails to a folder called 'processed' there are always a couple of unread emails left in the inbox. i suspect the automation looses it's place when it moves to another folder and skips emails in the inbox.
>>>>so my iniitial idea was to count unread - and if number was not at 0, have the program loop and go through the lot again. to do this i have to move irrelevant emails into a folder called "tempbox" then move them back after completing processing.
>>>>
>>>>Perhaps you can think of a more efficient way of dealing with the initial problem (of missing unread) to save me creating a new folder.
>>>>
>>>>thanks for the tries and thoughts.
>>>>
>>>>k
>>>>
>>>>
>>>>>>I have successfully created a folder called "TempBox". How do i delete this folder after i have finished?
>>>>>>
>>>>>>thanks for all the help.
>>>>>>k
>>>>>>
>>>>>>
>>>>>>Local loOutlook   As Outlook.Application
>>>>>>Local loNameSpace As Outlook.NameSpace
>>>>>>Local loInBox     As Object
>>>>>>Local loMSG      As Outlook.MailItem
>>>>>>Local lnUnRead    As Integer
>>>>>>Local loAttach,llAttach
>>>>>>
>>>>>>#Define olFolderInBox      6
>>>>>>
>>>>>>loOutlook   = Createobject('Outlook.Application') &&
>>>>>>loNameSpace = loOutlook.GetNamespace("MAPI")
>>>>>>loInBox     = loNameSpace.GetDefaultFolder(olFolderInBox)
>>>>>>lnUnRead    = 0
>>>>>>
>>>>>>Local loNewFolder
>>>>>>
>>>>>>loNewFolder=loNameSpace.Folders("Personal Folders").Folders.Add('TempBox')  && This creates a folder. 
>>>>>>
>>>>>>
>>>>>
>>>>>Sorry, try
>>>>>
>>>>>loNameSpace.Folders("Personal Folders").Folders.Remove('TempBox')
Previous
Reply
Map
View

Click here to load this message in the networking platform