How to use .ShowAsOutlookAB

Hi,

so i had this Problem:
https://www.experts-exchange.com/questions/29077332/Converting-VBA-in-VBS.html?anchor=a42428718¬ificationFollowed=202388954#a42428718
It got solved, but now i need to show all contactfolders within this "GR" main folder as address books.
I found this property (.ShowAsOutlookAB) but i need to get into the subfolders to use it, so i need the syntax to get to it like:

set objFolder = objOutlook.Session.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders.Item("GR\<subcontactfolder>")

i tried this one but it didnt work so i think its the wrong syntax.

Regards
Jonas HuberAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewIT / Software Engineering ConsultantCommented:
Each node needs to be a ne ITEM, so try:

set objFolder = objOutlook.Session.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders.Item("GR").Item("<subcontactfolder>")

Open in new window


»bp
Jonas HuberAuthor Commented:
 const olPublicFoldersAllPublicFolders=18
Dim objOutlook
Dim objFolder
Dim objItemBGN
 set objOutlook = CreateObject("Outlook.Application")
 set objFolder = objOutlook.Session.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders.Item("GR") 
 objFolder.AddToPFFavorites
set objItemBGN = objOutlook.Session.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders.Item("GR").Item("BGN")
 objItemBGN.ShowAsOutlookAB

Open in new window


my code looks like this now and i get an error in line 8 , that the object does not support the property
Bill PrewIT / Software Engineering ConsultantCommented:
So, is BGN a true folder, or perhaps a Contacts object?


»bp
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Jonas HuberAuthor Commented:
BGN is a Contactfolder which needs to be displayed like an address book.
Bill PrewIT / Software Engineering ConsultantCommented:
Sorry, was forgetting the object model just a bit there.  I think this should work:

Const olPublicFoldersAllPublicFolders=18
Dim objOutlook
Dim objFolder
Dim objItemBGN
Set objOutlook = CreateObject("Outlook.Application")
Set objFolder = objOutlook.Session.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("GR") 
objFolder.AddToPFFavorites
Set objItemBGN = objOutlook.Session.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("GR").Folders("BGN")
objItemBGN.ShowAsOutlookAB

Open in new window


»bp
Jonas HuberAuthor Commented:
Now i get an error in line 9 , that the argument (ShowAsOutlookAB) is not optional.
Bill PrewIT / Software Engineering ConsultantCommented:
Try:

objItemBGN.ShowAsOutlookAB = True


»bp

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jonas HuberAuthor Commented:
Ok that worked thanks so far.
Just one question, nothing important, but its marked as "show as address book" in the publicfolder section.
Is it possible to get it marked in the favorite section?
What do i have to change ?
I mean it's the same result, but just for me to understand.
Bill PrewIT / Software Engineering ConsultantCommented:
Are you trying to add it to the Public Folder Favorites?

Or the Outlook Mail Favorites?

Or is it already in the PF Favs, and you want to change how it looks in the Favs section?

Sorry, not sure what you are asking...


»bp
Jonas HuberAuthor Commented:
With the code i posted earlier i add it to the PF fav. and in this section you can tick them for showing up as address book like we did with:

objItemBGN.ShowAsOutlookAB = True

Open in new window


But we did it in the PF section and i'd like to do that in the PF fav. section. In both scenarios i'd would show up the same way, but on removal it would react in diffrent ways. But as i said nothing important.
Bill PrewIT / Software Engineering ConsultantCommented:
Searched around a bit, and I didn't stumble on to a way to access the items in the PF Favs "folder", not sure if it's possible in VBA or not, but couldn't find it quickly.


»bp
Jonas HuberAuthor Commented:
Ok nevermind but thanks for your help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.