Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determine outlook folder numbers
Message
From
22/03/2010 15:01:58
 
 
To
22/03/2010 08:38:31
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01455990
Message ID:
01456232
Views:
48
Thanks a lot Tamar - i didn't know about this! this makes things a lot easier. We can set up all computers with a common Folder name and take the guess work out of everything.

k

>>The code below moves unread emails from the inbox to a folder called 'Done'. It works on my computer but it's a little difficult to figure out the folder names-numbers on other computers - it's guess work. On one i worked on inbox is folder is 4 - on mine it's folder 1.
>>Is there a couple of line of code i can introduce to show what folder names correspond to what folder numbers - there sems to be no logical ordering of numbers.
>
>You don't need the numbers. One of the cool things about collections is that you can refer to items by name. So to reference the "Done" folder of the Inbox, use:
>
>loInbox.Folders["Done"]
>
>Tamar
>
>
>>
>>
>>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
>>
>>*-- At this point we have the InBox Object.
>>*-- Let's display how many messages we have in the Inbox.
>>Mess = "You have " + Transform(loInBox.Items.Count) + " Messages"+Chr(13)+"Scanning for unread messages"
>>Wait Window Mess+Chr(13)+"Please wait...." Nowait At 3,112
>>For Each loMSG In loInBox.Items
>>If loMSG.UnRead
>>		loAttach = loMSG.attachments   && attachments object
>>		llAttach = Iif(loAttach.Count > 0,.T.,.F.)   && number of attachments
>>
>>		loMSG.SaveAs('c:\vaniermu\attachments\email.txt',0)
>>
>>		wordfound = "N"
>>		lnUnRead = lnUnRead + 1
>>
>>		tem= loMSG.SenderName
>>		temO=loMSG.SenderName
>>		son = mdy(loMSG.SentOn)
>>		sub = loMSG.Subject
>>		* loMSG.body
>>			
>>		If llAttach  
>>		loAttachment = loMSG.attachments(loAttach.Count)
>>		For Each loAttachment In loMSG.attachments
>>		loAttachment.SaveAsFile("c:\vaniermu\attachments\"+loAttachment.filename)   && save attachment
>>		Next
>>		endif
>>		 
>>*loMsg.unRead = .F. && Mark it as read
>>=loMSG.Move(loNameSpace.Folders(1).Folders(14))   
>>
>>
>>**ELSE &&& this displays titles of read messages
>>**  ? "Read Message Subject: " + loMSG.Subject
>>Endif
>>
>>Endfor
>>
>>
>>
>>
Previous
Reply
Map
View

Click here to load this message in the networking platform