Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: saving to User Created contact folders

Geek News

saving to User Created contact folders
"Rick H" <rickh_1960[ at ]hotmail.com> 6/30/2006 3:26:29 PM
This is code from my UO in Powerbuilder.
Everything works fine except for the last line. If the client is using
a Personal folder which they created such as ls_folder = "MYContacts"
I know this isn't a Powerbuilder group but was hoping for some help
with the folder items in Outlook.
If they are using the Default folder or a User Created folder in the
Public Folders the code below works fine.
BUT a User Created folder in the DefaultFolder(10) gets the error
"Error Calling External Function "item""
The code is the same except that ls_folder is the name of the user
created folder name stored in the database.
Public = ls_folder = "MyPublic_folders"
Personal = ls_folder = "MyPersonal_folder"

If ll_folder_class = 18 then
myFolder = olns_hold.GetDefaultFolder(18) //PUBLIC
FOLDERS
myNewFolder = myFolder.Folders.Item('' + ls_folder + '')
Else
If ls_folder = 'Contacts' Then
myNewFolder = olns_hold.GetDefaultFolder(10) //Non PUBLIC
FOLDERS
Else
myFolder = olns_hold.GetDefaultFolder(10) //Non DEFAULT
PUBLIC FOLDERS
myNewFolder = myFolder.Folders.Item('' + ls_folder + '')
End If
End IF
olns_hold =
iole_outlook.CreateItemFromTemplate(gnv_priorities.is_program_dir +
"samconimp.oft", myNewFolder)

Re: saving to User Created contact folders
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 6/30/2006 9:26:06 PM
If I understand what you're asking, you cannot open a non-default contacts
folder using GetDefaultFolder. You either have to use GetFolderFromID or
iterate the Folders collection to get the folder you want. If it's not a
folder at the same level as Calendar you'd have to recursively iterate
folders from the top of store down to find the one you want.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Rick H" <rickh_1960[ at ]hotmail.com> wrote in message
news:1151681189.013451.260410[ at ]p79g2000cwp.googlegroups.com...
[Quoted Text]
> This is code from my UO in Powerbuilder.
> Everything works fine except for the last line. If the client is using
> a Personal folder which they created such as ls_folder = "MYContacts"
> I know this isn't a Powerbuilder group but was hoping for some help
> with the folder items in Outlook.
> If they are using the Default folder or a User Created folder in the
> Public Folders the code below works fine.
> BUT a User Created folder in the DefaultFolder(10) gets the error
> "Error Calling External Function "item""
> The code is the same except that ls_folder is the name of the user
> created folder name stored in the database.
> Public = ls_folder = "MyPublic_folders"
> Personal = ls_folder = "MyPersonal_folder"
>
> If ll_folder_class = 18 then
> myFolder = olns_hold.GetDefaultFolder(18) //PUBLIC
> FOLDERS
> myNewFolder = myFolder.Folders.Item('' + ls_folder + '')
> Else
> If ls_folder = 'Contacts' Then
> myNewFolder = olns_hold.GetDefaultFolder(10) //Non PUBLIC
> FOLDERS
> Else
> myFolder = olns_hold.GetDefaultFolder(10) //Non DEFAULT
> PUBLIC FOLDERS
> myNewFolder = myFolder.Folders.Item('' + ls_folder + '')
> End If
> End IF
> olns_hold =
> iole_outlook.CreateItemFromTemplate(gnv_priorities.is_program_dir +
> "samconimp.oft", myNewFolder)
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net