Outlook and non-default folder
Moderator: Moderatoren
Outlook and non-default folder
Hi,
i can't understand how to access a non-default folder of outlook, such as:
Outlook
|- contacts
|- calendar
|- myPersonalCalendar (<-----)
|- ecc.
from VB:
Set myNameSpace = Application.GetNameSpace("MAPI")
Set myFolder = _myNameSpace.GetDefaultFolder(olFolderCalendar)
Set myNewFolder = myFolder.Folders("myPersonalCalendar")
from XB:
oNameSpace := oOutlook:GetNamespace( "MAPI" )
oAppointment := oNameSpace:getDefaultFolder( oLFolderCalendar )
??????
many thanks for your suggestions
i can't understand how to access a non-default folder of outlook, such as:
Outlook
|- contacts
|- calendar
|- myPersonalCalendar (<-----)
|- ecc.
from VB:
Set myNameSpace = Application.GetNameSpace("MAPI")
Set myFolder = _myNameSpace.GetDefaultFolder(olFolderCalendar)
Set myNewFolder = myFolder.Folders("myPersonalCalendar")
from XB:
oNameSpace := oOutlook:GetNamespace( "MAPI" )
oAppointment := oNameSpace:getDefaultFolder( oLFolderCalendar )
??????
many thanks for your suggestions
- Wolfgang Ciriack
- Der Entwickler von "Deep Thought"
- Beiträge: 2978
- Registriert: Sa, 24. Sep 2005 9:37
- Wohnort: Berlin
- Hat sich bedankt: 15 Mal
- Danksagung erhalten: 38 Mal
- Kontaktdaten:
Re: Outlook and non-default folder
Hi,
i only have a solution to pick a folder:
i only have a solution to pick a folder:
Code: Alles auswählen
oNS := oOutlook:GetNamespace( "MAPI" )
oFolder:=oNS:PickFolder()
if oFolder:DefaultItemType<>olAppointmentItem
** no appointment folder
.......
myId:=oFolder:EntryID
.....
if empty(myId)
oAppoint:=oNS:GetDefaultFolder(olFolderCalendar)
else
oAppoint:=oNS:GetFolderFromID(myid)
endif
.....
nOlCount:=oAppoint:items:count
......
Viele Grüße
Wolfgang
Wolfgang
Re: Outlook and non-default folder
but searching online the method PickFolder :
The Pick Folder dialog box is a modal dialog box which means that code execution will not continue until the user either selects a folder or cancels the dialog box
I'll want to access on my non-default folder without opening a dialog box
The Pick Folder dialog box is a modal dialog box which means that code execution will not continue until the user either selects a folder or cancels the dialog box
I'll want to access on my non-default folder without opening a dialog box
- Wolfgang Ciriack
- Der Entwickler von "Deep Thought"
- Beiträge: 2978
- Registriert: Sa, 24. Sep 2005 9:37
- Wohnort: Berlin
- Hat sich bedankt: 15 Mal
- Danksagung erhalten: 38 Mal
- Kontaktdaten:
Re: Outlook and non-default folder
Do the folder select in you config and save the ID (myid). Then you can pass the id to oNS:GetFolderFromID(myid).
Perhaps there is a function oNS:GetFolderFromName("myfolder") ?
Perhaps there is a function oNS:GetFolderFromName("myfolder") ?
Viele Grüße
Wolfgang
Wolfgang
Re: Outlook and non-default folder
I've found this:
https://msdn.microsoft.com/en-us/librar ... e.11).aspx
Using the Folders Object
Use the Folders property to return the Folders object from a NameSpace object or another MAPIFolder object.
Use Folders(index), where index is the name or index number, to return a single MAPIFolder object. Folder names are case-sensitive.
The following Visual Basic for Applications (VBA) example returns the folder named Old Contacts.
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNameSpace("MAPI")
Set myFolder = _
myNameSpace.GetDefaultFolder(olFolderContacts)
Set myNewFolder = myFolder.Folders("Old Contacts")
The following Visual Basic for Applications example returns the first folder.
Set myNewFolder = myFolder.Folders(1)
But i can't write in correct xbase format.
Can you help me ?
https://msdn.microsoft.com/en-us/librar ... e.11).aspx
Using the Folders Object
Use the Folders property to return the Folders object from a NameSpace object or another MAPIFolder object.
Use Folders(index), where index is the name or index number, to return a single MAPIFolder object. Folder names are case-sensitive.
The following Visual Basic for Applications (VBA) example returns the folder named Old Contacts.
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNameSpace("MAPI")
Set myFolder = _
myNameSpace.GetDefaultFolder(olFolderContacts)
Set myNewFolder = myFolder.Folders("Old Contacts")
The following Visual Basic for Applications example returns the first folder.
Set myNewFolder = myFolder.Folders(1)
But i can't write in correct xbase format.
Can you help me ?
- AUGE_OHR
- Marvin
- Beiträge: 12931
- Registriert: Do, 16. Mär 2006 7:55
- Wohnort: Hamburg
- Hat sich bedankt: 20 Mal
- Danksagung erhalten: 48 Mal
Re: Outlook and non-default folder
Syntax is right but for Xbase++ you must find "right" Object -> Root of ol* Constante-> o:Parentsimofranz hat geschrieben: ↑Fr, 30. Sep 2016 12:07 The following Visual Basic for Applications example returns the first folder.Code: Alles auswählen
Set myNewFolder = myFolder.Folders(1)
gruss by OHR
Jimmy
Jimmy