![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
My vb.net app currently has a button for Outlook Contacts that sets focus to
Outlook, specifically the Contacts tab. Can I programmatically set focus to a specific address book on the Contacts tab? I know I could physically set each workstation using the "Show this address book first". But, the users could change that. So, can I set focus to the correct address book from my app? For example, my company has a global address list with all employees in it, and I want to set focus to that address book instead of the user's personal address book. Current code Dim olApp As Outlook.Application Dim oNS As Outlook.NameSpace olApp = CreateObject("Outlook.Application") oNS = olApp.GetNamespace("MAPI") If olApp.ActiveWindow Is Nothing Then oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFo lderContacts).Display() Else oNS.Application.ActiveExplorer.CurrentFolder = oNS.Application.ActiveExplorer.Session.GetDefaultF older(Outlook.OlDefaultFolders.olFolderContacts) End If oNS.Application.ActiveExplorer.WindowState = Outlook.OlWindowState.olNormalWindow oNS.Application.ActiveExplorer.Left = 215 oNS.Application.ActiveExplorer.Top = 87 oNS.Application.ActiveExplorer.Width = 800 oNS.Application.ActiveExplorer.Height = 627 oNS.Application.ActiveExplorer.Activate() olApp = Nothing |
#2
|
|||
|
|||
![]()
I'm not sure what you mean by "the Contacts tab" or "a specific address book
on the Contacts tab." Furthermore, the Global Address List doesn't display in the main (Explorer) window in Outlook at all. If you're trying to display a specific contacts folder in Outlook's main window, once your code returns that folder, use it to set the value of ActiveExplorer.CurrentFolder. If that's not what you're trying to do, please provide more details and include your version of Outlook. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming: Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "ttempl" wrote: My vb.net app currently has a button for Outlook Contacts that sets focus to Outlook, specifically the Contacts tab. Can I programmatically set focus to a specific address book on the Contacts tab? I know I could physically set each workstation using the "Show this address book first". But, the users could change that. So, can I set focus to the correct address book from my app? For example, my company has a global address list with all employees in it, and I want to set focus to that address book instead of the user's personal address book. Current code Dim olApp As Outlook.Application Dim oNS As Outlook.NameSpace olApp = CreateObject("Outlook.Application") oNS = olApp.GetNamespace("MAPI") If olApp.ActiveWindow Is Nothing Then oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFo lderContacts).Display() Else oNS.Application.ActiveExplorer.CurrentFolder = oNS.Application.ActiveExplorer.Session.GetDefaultF older(Outlook.OlDefaultFolders.olFolderContacts) End If oNS.Application.ActiveExplorer.WindowState = Outlook.OlWindowState.olNormalWindow oNS.Application.ActiveExplorer.Left = 215 oNS.Application.ActiveExplorer.Top = 87 oNS.Application.ActiveExplorer.Width = 800 oNS.Application.ActiveExplorer.Height = 627 oNS.Application.ActiveExplorer.Activate() olApp = Nothing |
#3
|
|||
|
|||
![]()
Sorry, Sue. I was afraid I wouldn't explain myself well. We are using Outlook
Express 2007. I see what you mean... the Global Address List doesn't display in the main window at all. I'm getting myself confused with terminology between My Contacts and the Address Book. I think what we want is to display the Global Address List. Manually, I can go to Tools -- Address Book and choose the proper "Show names from the..." drop down. I need to know how to do that programmatically if it is possible. "Sue Mosher [MVP-Outlook]" wrote: I'm not sure what you mean by "the Contacts tab" or "a specific address book on the Contacts tab." Furthermore, the Global Address List doesn't display in the main (Explorer) window in Outlook at all. If you're trying to display a specific contacts folder in Outlook's main window, once your code returns that folder, use it to set the value of ActiveExplorer.CurrentFolder. If that's not what you're trying to do, please provide more details and include your version of Outlook. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming: Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "ttempl" wrote: My vb.net app currently has a button for Outlook Contacts that sets focus to Outlook, specifically the Contacts tab. Can I programmatically set focus to a specific address book on the Contacts tab? I know I could physically set each workstation using the "Show this address book first". But, the users could change that. So, can I set focus to the correct address book from my app? For example, my company has a global address list with all employees in it, and I want to set focus to that address book instead of the user's personal address book. Current code Dim olApp As Outlook.Application Dim oNS As Outlook.NameSpace olApp = CreateObject("Outlook.Application") oNS = olApp.GetNamespace("MAPI") If olApp.ActiveWindow Is Nothing Then oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFo lderContacts).Display() Else oNS.Application.ActiveExplorer.CurrentFolder = oNS.Application.ActiveExplorer.Session.GetDefaultF older(Outlook.OlDefaultFolders.olFolderContacts) End If oNS.Application.ActiveExplorer.WindowState = Outlook.OlWindowState.olNormalWindow oNS.Application.ActiveExplorer.Left = 215 oNS.Application.ActiveExplorer.Top = 87 oNS.Application.ActiveExplorer.Width = 800 oNS.Application.ActiveExplorer.Height = 627 oNS.Application.ActiveExplorer.Activate() olApp = Nothing |
#4
|
|||
|
|||
![]()
I'm still confused. There is no such thing as "Outlook Express 2007." Do you
mean Outlook 2007? If so, are you just trying to display the address book programmatically for the user to select names from it? Display it, but not for selection? Change the user's default address list? -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming: Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "ttempl" wrote: Sorry, Sue. I was afraid I wouldn't explain myself well. We are using Outlook Express 2007. I see what you mean... the Global Address List doesn't display in the main window at all. I'm getting myself confused with terminology between My Contacts and the Address Book. I think what we want is to display the Global Address List. Manually, I can go to Tools -- Address Book and choose the proper "Show names from the..." drop down. I need to know how to do that programmatically if it is possible. "Sue Mosher [MVP-Outlook]" wrote: I'm not sure what you mean by "the Contacts tab" or "a specific address book on the Contacts tab." Furthermore, the Global Address List doesn't display in the main (Explorer) window in Outlook at all. If you're trying to display a specific contacts folder in Outlook's main window, once your code returns that folder, use it to set the value of ActiveExplorer.CurrentFolder. If that's not what you're trying to do, please provide more details and include your version of Outlook. "ttempl" wrote: My vb.net app currently has a button for Outlook Contacts that sets focus to Outlook, specifically the Contacts tab. Can I programmatically set focus to a specific address book on the Contacts tab? I know I could physically set each workstation using the "Show this address book first". But, the users could change that. So, can I set focus to the correct address book from my app? For example, my company has a global address list with all employees in it, and I want to set focus to that address book instead of the user's personal address book. Current code Dim olApp As Outlook.Application Dim oNS As Outlook.NameSpace olApp = CreateObject("Outlook.Application") oNS = olApp.GetNamespace("MAPI") If olApp.ActiveWindow Is Nothing Then oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFo lderContacts).Display() Else oNS.Application.ActiveExplorer.CurrentFolder = oNS.Application.ActiveExplorer.Session.GetDefaultF older(Outlook.OlDefaultFolders.olFolderContacts) End If oNS.Application.ActiveExplorer.WindowState = Outlook.OlWindowState.olNormalWindow oNS.Application.ActiveExplorer.Left = 215 oNS.Application.ActiveExplorer.Top = 87 oNS.Application.ActiveExplorer.Width = 800 oNS.Application.ActiveExplorer.Height = 627 oNS.Application.ActiveExplorer.Activate() olApp = Nothing |
#5
|
|||
|
|||
![]()
Obviously, I'm learning as I go and am a bit of a middleman on this one.
Sorry, yes, Outlook 2007. Yes, just displaying the address book, so the user can view phone numbers and such. Display it, but not for selection. There would be a button in my app called "Company Directory" for example, that would get the user to the GAL to view address and phone numbers. Will this code get me close? Dim outApp As Object, outNS As Outlook.NameSpace Dim myAddressList As Outlook.AddressList outApp = CreateObject("Outlook.Application") outNS = outApp.GetNamespace("MAPI") myAddressList = outNS.Session.AddressLists("Global Address List") outNS.Application.ActiveExplorer.CurrentFolder = myAddressList outApp = Nothing "Sue Mosher [MVP-Outlook]" wrote: I'm still confused. There is no such thing as "Outlook Express 2007." Do you mean Outlook 2007? If so, are you just trying to display the address book programmatically for the user to select names from it? Display it, but not for selection? Change the user's default address list? -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming: Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "ttempl" wrote: Sorry, Sue. I was afraid I wouldn't explain myself well. We are using Outlook Express 2007. I see what you mean... the Global Address List doesn't display in the main window at all. I'm getting myself confused with terminology between My Contacts and the Address Book. I think what we want is to display the Global Address List. Manually, I can go to Tools -- Address Book and choose the proper "Show names from the..." drop down. I need to know how to do that programmatically if it is possible. "Sue Mosher [MVP-Outlook]" wrote: I'm not sure what you mean by "the Contacts tab" or "a specific address book on the Contacts tab." Furthermore, the Global Address List doesn't display in the main (Explorer) window in Outlook at all. If you're trying to display a specific contacts folder in Outlook's main window, once your code returns that folder, use it to set the value of ActiveExplorer.CurrentFolder. If that's not what you're trying to do, please provide more details and include your version of Outlook. "ttempl" wrote: My vb.net app currently has a button for Outlook Contacts that sets focus to Outlook, specifically the Contacts tab. Can I programmatically set focus to a specific address book on the Contacts tab? I know I could physically set each workstation using the "Show this address book first". But, the users could change that. So, can I set focus to the correct address book from my app? For example, my company has a global address list with all employees in it, and I want to set focus to that address book instead of the user's personal address book. Current code Dim olApp As Outlook.Application Dim oNS As Outlook.NameSpace olApp = CreateObject("Outlook.Application") oNS = olApp.GetNamespace("MAPI") If olApp.ActiveWindow Is Nothing Then oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFo lderContacts).Display() Else oNS.Application.ActiveExplorer.CurrentFolder = oNS.Application.ActiveExplorer.Session.GetDefaultF older(Outlook.OlDefaultFolders.olFolderContacts) End If oNS.Application.ActiveExplorer.WindowState = Outlook.OlWindowState.olNormalWindow oNS.Application.ActiveExplorer.Left = 215 oNS.Application.ActiveExplorer.Top = 87 oNS.Application.ActiveExplorer.Width = 800 oNS.Application.ActiveExplorer.Height = 627 oNS.Application.ActiveExplorer.Activate() olApp = Nothing |
#6
|
|||
|
|||
![]()
No, that's the sort of code you'd use to work with the GAL programmatically.
There is no specific method in the Outlook object model for displaying the address book for viewing not selection. You can, however, use the CommandBars techniques to execute any toolbar command, including Tools | Address Book. See http://www.outlookcode.com/d/tips/commandbarfun.htm. The ID for that command is 353. There is no option in the Outlook object model for displaying a specific address list using that technique. If you want to display the address list for selection, however, you can use the Namespace.GetSelectNamesDialog method to return a SelectNamesDialog object and set its InitialAddressList and other useful properties. Maybe that will suit your application better. If neither of those solutions works for you, then the obvious alternative is to build your own Windows form display whatever you want users to see. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming: Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "ttempl" wrote: Obviously, I'm learning as I go and am a bit of a middleman on this one. Sorry, yes, Outlook 2007. Yes, just displaying the address book, so the user can view phone numbers and such. Display it, but not for selection. There would be a button in my app called "Company Directory" for example, that would get the user to the GAL to view address and phone numbers. Will this code get me close? Dim outApp As Object, outNS As Outlook.NameSpace Dim myAddressList As Outlook.AddressList outApp = CreateObject("Outlook.Application") outNS = outApp.GetNamespace("MAPI") myAddressList = outNS.Session.AddressLists("Global Address List") outNS.Application.ActiveExplorer.CurrentFolder = myAddressList outApp = Nothing Sorry, Sue. I was afraid I wouldn't explain myself well. We are using Outlook Express 2007. I see what you mean... the Global Address List doesn't display in the main window at all. I'm getting myself confused with terminology between My Contacts and the Address Book. I think what we want is to display the Global Address List. Manually, I can go to Tools -- Address Book and choose the proper "Show names from the..." drop down. I need to know how to do that programmatically if it is possible. "Sue Mosher [MVP-Outlook]" wrote: I'm not sure what you mean by "the Contacts tab" or "a specific address book on the Contacts tab." Furthermore, the Global Address List doesn't display in the main (Explorer) window in Outlook at all. If you're trying to display a specific contacts folder in Outlook's main window, once your code returns that folder, use it to set the value of ActiveExplorer.CurrentFolder. If that's not what you're trying to do, please provide more details and include your version of Outlook. "ttempl" wrote: My vb.net app currently has a button for Outlook Contacts that sets focus to Outlook, specifically the Contacts tab. Can I programmatically set focus to a specific address book on the Contacts tab? I know I could physically set each workstation using the "Show this address book first". But, the users could change that. So, can I set focus to the correct address book from my app? For example, my company has a global address list with all employees in it, and I want to set focus to that address book instead of the user's personal address book. Current code Dim olApp As Outlook.Application Dim oNS As Outlook.NameSpace olApp = CreateObject("Outlook.Application") oNS = olApp.GetNamespace("MAPI") If olApp.ActiveWindow Is Nothing Then oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFo lderContacts).Display() Else oNS.Application.ActiveExplorer.CurrentFolder = oNS.Application.ActiveExplorer.Session.GetDefaultF older(Outlook.OlDefaultFolders.olFolderContacts) End If oNS.Application.ActiveExplorer.WindowState = Outlook.OlWindowState.olNormalWindow oNS.Application.ActiveExplorer.Left = 215 oNS.Application.ActiveExplorer.Top = 87 oNS.Application.ActiveExplorer.Width = 800 oNS.Application.ActiveExplorer.Height = 627 oNS.Application.ActiveExplorer.Activate() olApp = Nothing |
#7
|
|||
|
|||
![]()
No, that's the sort of code you'd use if you wanted to build your own Windows
form from the data in the GAL. The closest thing the Outlook object model has to offer you is the Namespace.GetSelectNamesDialog method, which returns a SelectNamesDialog object whose various properties you can set. This is a dialog for selection, not just viewing, but it's the only way available to control what address list the user sees. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming: Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "ttempl" wrote: Obviously, I'm learning as I go and am a bit of a middleman on this one. Sorry, yes, Outlook 2007. Yes, just displaying the address book, so the user can view phone numbers and such. Display it, but not for selection. There would be a button in my app called "Company Directory" for example, that would get the user to the GAL to view address and phone numbers. Will this code get me close? Dim outApp As Object, outNS As Outlook.NameSpace Dim myAddressList As Outlook.AddressList outApp = CreateObject("Outlook.Application") outNS = outApp.GetNamespace("MAPI") myAddressList = outNS.Session.AddressLists("Global Address List") outNS.Application.ActiveExplorer.CurrentFolder = myAddressList outApp = Nothing "Sue Mosher [MVP-Outlook]" wrote: I'm still confused. There is no such thing as "Outlook Express 2007." Do you mean Outlook 2007? If so, are you just trying to display the address book programmatically for the user to select names from it? Display it, but not for selection? Change the user's default address list? "ttempl" wrote: Sorry, Sue. I was afraid I wouldn't explain myself well. We are using Outlook Express 2007. I see what you mean... the Global Address List doesn't display in the main window at all. I'm getting myself confused with terminology between My Contacts and the Address Book. I think what we want is to display the Global Address List. Manually, I can go to Tools -- Address Book and choose the proper "Show names from the..." drop down. I need to know how to do that programmatically if it is possible. "Sue Mosher [MVP-Outlook]" wrote: I'm not sure what you mean by "the Contacts tab" or "a specific address book on the Contacts tab." Furthermore, the Global Address List doesn't display in the main (Explorer) window in Outlook at all. If you're trying to display a specific contacts folder in Outlook's main window, once your code returns that folder, use it to set the value of ActiveExplorer.CurrentFolder. If that's not what you're trying to do, please provide more details and include your version of Outlook. "ttempl" wrote: My vb.net app currently has a button for Outlook Contacts that sets focus to Outlook, specifically the Contacts tab. Can I programmatically set focus to a specific address book on the Contacts tab? I know I could physically set each workstation using the "Show this address book first". But, the users could change that. So, can I set focus to the correct address book from my app? For example, my company has a global address list with all employees in it, and I want to set focus to that address book instead of the user's personal address book. Current code Dim olApp As Outlook.Application Dim oNS As Outlook.NameSpace olApp = CreateObject("Outlook.Application") oNS = olApp.GetNamespace("MAPI") If olApp.ActiveWindow Is Nothing Then oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFo lderContacts).Display() Else oNS.Application.ActiveExplorer.CurrentFolder = oNS.Application.ActiveExplorer.Session.GetDefaultF older(Outlook.OlDefaultFolders.olFolderContacts) End If oNS.Application.ActiveExplorer.WindowState = Outlook.OlWindowState.olNormalWindow oNS.Application.ActiveExplorer.Left = 215 oNS.Application.ActiveExplorer.Top = 87 oNS.Application.ActiveExplorer.Width = 800 oNS.Application.ActiveExplorer.Height = 627 oNS.Application.ActiveExplorer.Activate() olApp = Nothing |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
No contacts displayed...will not display a new one...will not display imported address book HELP!! | Duncan Mullins | Outlook Express | 2 | January 26th 08 12:32 AM |
Will not display contacts-won't display new contact-won't display imported address book-HELP!! | Duncan Mullins | Outlook Express | 12 | January 26th 08 12:04 AM |
Contacts display in TO: field, but don't show up in Contacts | LindsayG | Outlook - Using Contacts | 3 | July 4th 07 11:41 AM |
send email to multiple contacts, but not display other contacts in to field | Tim | Outlook - General Queries | 1 | January 31st 07 10:19 PM |
Doesn't display contacts | Louise | Outlook - Using Contacts | 11 | January 31st 06 11:21 AM |