dmoonme Posted April 20, 2005 Posted April 20, 2005 Hi, I want to retrieve all contact information within a catergory named "Staff" in a folder named "RC Contacts." This should explain where I'm trying to get in better: +Outlook Today . -Public Folders . ....-All Public Folder . ....-Contact Mgmt . ....-RC Contacts . ....+Categories: BLAH ....+Categories: Staff I can get to the RC Contacts but I don't know how to get in the "Staff" categories and enumerate all the items inside. Here's what I have so far: Sub Main() Try Dim objOutlook As Outlook._Application objOutlook = New Outlook.Application Dim objNS As Outlook._NameSpace = objOutlook.Session Dim objFolder As Outlook.MAPIFolder = _ objNS.Folders.Item("Public Folders") objFolder = objFolder.Folders.Item("All Public Folders") objFolder = objFolder.Folders.Item("Contact Mgmt") objFolder = objFolder.Folders.Item("RC Contacts") Dim objItems As Object = objFolder.Items Dim objItem As Object For Each objItem In objItems Console.WriteLine(objItem & vbCrLf) Next Catch ex As Exception Console.Writeline(ex.Message) End Try End Sub Quote
mark007 Posted April 21, 2005 Posted April 21, 2005 The following should do the trick Sub Main() Try Dim objOutlook As Outlook._Application objOutlook = New Outlook.Application Dim objNS As Outlook._NameSpace = objOutlook.Session Dim objFolder As Outlook.MAPIFolder = _ objNS.Folders.Item("Public Folders") objFolder = objFolder.Folders.Item("All Public Folders") objFolder = objFolder.Folders.Item("Contact Mgmt") objFolder = objFolder.Folders.Item("RC Contacts") Dim objItems As Object = objFolder.Items Dim objItem As Object For Each objItem In objItems if System.Convert.ToString(objItem.Categories).IndexOf("Staff")>-1 then Console.WriteLine(objItem.Email1Address & vbCrLf) End if Next Catch ex As Exception Console.Writeline(ex.Message) End Try End Sub HTH :) Quote Please check the Knowledge Base before you post. "Computers are useless. They can only give you answers." - Pablo Picasso The Code Net
dmoonme Posted April 21, 2005 Author Posted April 21, 2005 Thanks mark007! Would you happen to know how to get the alias name or smtp email address as well? I couldn't find any property to get the alias or smtp email address. THANKS AGAIN! Quote
mark007 Posted April 21, 2005 Posted April 21, 2005 Not sure exactly what you mean but the available properties of contact items (in 2000 anyway, there may be more in later versions) are: Account Property Actions Property Anniversary Property Application Property AssistantName Property AssistantTelephoneNumber Property Attachments Property BillingInformation Property Birthday Property Body Property Business2TelephoneNumber Property BusinessAddress Property BusinessAddressCity Property BusinessAddressCountry Property BusinessAddressPostOfficeBox Property BusinessAddressPostalCode Property BusinessAddressState Property BusinessAddressStreet Property BusinessFaxNumber Property BusinessHomePage Property BusinessTelephoneNumber Property CallbackTelephoneNumber Property CarTelephoneNumber Property Categories Property Children Property Class Property Companies Property CompanyAndFullName Property CompanyLastFirstNoSpace Property CompanyLastFirstSpaceOnly Property CompanyMainTelephoneNumber Property CompanyName Property ComputerNetworkName Property ConversationIndex Property ConversationTopic Property CreationTime Property CustomerID Property Department Property DownloadState Property Email1Address Property Email1AddressType Property Email1DisplayName Property Email1EntryID Property Email2Address Property Email2AddressType Property Email2DisplayName Property Email2EntryID Property Email3Address Property Email3AddressType Property Email3DisplayName Property Email3EntryID Property EntryID Property FTPSite Property FileAs Property FirstName Property FormDescription Property FullName Property FullNameAndCompany Property Gender Property GetInspector Property GovernmentIDNumber Property Hobby Property Home2TelephoneNumber Property HomeAddress Property HomeAddressCity Property HomeAddressCountry Property HomeAddressPostOfficeBox Property HomeAddressPostalCode Property HomeAddressState Property HomeAddressStreet Property HomeFaxNumber Property HomeTelephoneNumber Property IMAddress Property ISDNNumber Property Importance Property Initials Property InternetFreeBusyAddress Property IsConflict Property ItemProperties Property JobTitle Property Journal Property Language Property LastFirstAndSuffix Property LastFirstNoSpace Property LastFirstNoSpaceAndSuffix Property LastFirstNoSpaceCompany Property LastFirstSpaceOnly Property LastFirstSpaceOnlyCompany Property LastModificationTime Property LastName Property LastNameAndFirstName Property Links Property MailingAddress Property MailingAddressCity Property MailingAddressCountry Property MailingAddressPostOfficeBox Property MailingAddressPostalCode Property MailingAddressState Property MailingAddressStreet Property ManagerName Property MarkForDownload Property MessageClass Property MiddleName Property Mileage Property MobileTelephoneNumber Property NetMeetingAlias Property NetMeetingServer Property NickName Property NoAging Property OfficeLocation Property OrganizationalIDNumber Property OtherAddress Property OtherAddressCity Property OtherAddressCountry Property OtherAddressPostOfficeBox Property OtherAddressPostalCode Property OtherAddressState Property OtherAddressStreet Property OtherFaxNumber Property OtherTelephoneNumber Property OutlookInternalVersion Property OutlookVersion Property PagerNumber Property Parent Property PersonalHomePage Property PrimaryTelephoneNumber Property Profession Property RadioTelephoneNumber Property ReferredBy Property Saved Property SelectedMailingAddress Property Sensitivity Property Session Property Size Property Spouse Property Subject Property Suffix Property TTYTDDTelephoneNumber Property TelexNumber Property Title Property UnRead Property User1 Property User2 Property User3 Property User4 Property UserCertificate Property UserProperties Property WebPage Property YomiCompanyName Property YomiFirstName Property YomiLastName Property HTH :) Quote Please check the Knowledge Base before you post. "Computers are useless. They can only give you answers." - Pablo Picasso The Code Net
dmoonme Posted April 27, 2005 Author Posted April 27, 2005 (edited) Hey mark007 thanks again for your help. When I run your code I sometimes get an "Unspecified Error" message or a form cannot be found error message. I am using Outlook 2000 and have sp1 installed as well. Any ideas on what causes this? Edited April 28, 2005 by dmoonme Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.