Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you determine the number of a folder? 1

Status
Not open for further replies.

DChalom

Programmer
Jun 8, 2002
59
US
I still need to know how to determine the number of a folder. I need to create a folder if one does not exist for this customer and then put the associated documents into that folder, so how do I determine the number of a folder?


Dorian C. Chalom
 
I'm not sure what you mean by the "number of the folder", but you can determine if a folder exists with the DIRECTORY() function. To get a count of the number of files in a folder, use ADIR().

Craig Berntson
MCSD, Visual FoxPro MVP, Author, CrysDev: A Developer's Guide to Integrating Crystal Reports"
 
I am sorry I should of mentioned in Outlook.

I need to create a folder if one does not exist for this customer and then put the associated documents into that folder, so how do I determine the number of a folder?


Dorian C. Chalom
 

I believe this FAQ (FAQ184-3894) was already mentionned to you. You will find near the bottom "Adding a folder in Outlook"

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Yes I looked at that and it tells me how to add a folder but not how then to reference that folder later to move something to it....

Dorian C. Chalom
 
Let us assume you created this new folder in the "personal folders" directory, you can reference by name. Here is how to find out all the names of the folders.
Code:
Local oOutlook,oNameSpace,oNewFolder
oOutlook=CREATEOBJECT('outlook.application')
oNameSpace=oOutlook.GetNamespace('mapi')
oFolders=oNameSpace.Folders(1).folders
FOR EACH oFolder IN oFolders
 ?oFolder.name
ENDFOR




Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I would like to properly thank you for information that will save me valuable time in the future.

Here's a STAR

Thanks,

Jim
 
Jim

I would like to properly thank you for information that will save me valuable time in the future.

You're welcome and thank for the star.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike,
My inbox has several sub-folders in in.
How to refere to these?
-Bart
 
Bart

My inbox has several sub-folders in in.

Since it has been determined that the inbox is folder #6 you would do it this way.

Code:
#DEFINE olFolderInBox 6
Local oOutlook,oNameSpace,oDefaultFolder
oOutlook=CREATEOBJECT('outlook.application')
oNameSpace=oOutlook.GetNamespace('mapi')
oDefaultFolder =oNameSpace.Getdefaultfolder(olFolderInBox)
oFolders=oDefaultFolder.folders
FOR EACH oFolder IN oFolders
 ?oFolder.name
ENDFOR


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike, thanks,
probably an idea to incorporate this in faq184-3894 ?
-Bart
 
Mgagnon,

Borrowing some of your script.

This is in anticipation of his next question. This will list all subfolders once the Inbox is located.
I was looking for something similar myself.


#DEFINE olFolderInBox 6
Local oOutlook,oNameSpace,oNewFolder
oOutlook=CREATEOBJECT('outlook.application')
oNameSpace=oOutlook.GetNamespace('mapi')
oFolders=oNameSpace.Folders(1).folders
FOR EACH oFolder IN oFolders
if oFolder.name = "Inbox"
oDefaultFolder =oNameSpace.Getdefaultfolder(olFolderInbox)
oFolders=oDefaultFolder.folders
FOR EACH oFolder IN oFolders
?oFolder.name
ENDFOR
endif
ENDFOR

Wish I could give you another star !!!!!!
Thanks,
Jim
 
Jim

Nice, but your code does not work for me. Here is the explanation, that might interrest others as well.

Code:
oFolders=oNameSpace.Folders(1).folders

The "1" in the above line refers (on my system ) to a main folder call "Archive Folders", and my "Inbox" is in a folder called "Personal Folders" with an index of "2". So an added loop my be required to make sure we are in the right main folder.

Code:
oFolders=oNameSpace.Folders(1).Name && Archive folders
oFolders=oNameSpace.Folders(2).Name && Personal folders.



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top