![]() |
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
|
|||
|
|||
![]()
Hi there,
When I create an appointment item in Outlook a can connect contact items with the button on the bottom of the screen, even contacts that don't have an email address can be choosen there! My question is, where is that data stored? I have a program written in VB 2005 with Outlook 2003 SP2. When I have the Outlook appointment available in my code as object, I can read and write allmost all values but I can't find a value where the connected contacts are stored. Anyone have an idea how to get this info? If it exists I also want to write values! Thanx a lot, Dikbill, The Netherlands |
Ads |
#2
|
|||
|
|||
![]()
Use the Links collection, which takes ContactItem objects in its Add method.
-- 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 "Dikbill" wrote in message . .. Hi there, When I create an appointment item in Outlook a can connect contact items with the button on the bottom of the screen, even contacts that don't have an email address can be choosen there! My question is, where is that data stored? I have a program written in VB 2005 with Outlook 2003 SP2. When I have the Outlook appointment available in my code as object, I can read and write allmost all values but I can't find a value where the connected contacts are stored. Anyone have an idea how to get this info? If it exists I also want to write values! Thanx a lot, Dikbill, The Netherlands |
#4
|
|||
|
|||
![]()
Dim oContact As Outlook.ContactItem
Dim AlreadyInstantiatedContact As Outlook.ContactItem Set oContact = Application.ActiveInspector.Links.Item(1) Set oContact = Application.ActiveInspector.Links.Add(AlreadyInsta ntiatedContact) -- 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 "Dikbill" wrote in message . .. Ken tx for your quick answer! Lazy as I am, do you have an example of this links collection? Thnx, Dikbill, The Netherlands, |
#5
|
|||
|
|||
![]()
Ken,
Thnx again! I've got it working, but....... :-) I get the following error on the instruction oContact = Item.Links.Item(1) In my case Item is the active Explorer! System.InvalidCastException was unhandled by user code Message="Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Outlook.ContactItem'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00063021-0000-0000-C000-000000000046}' failed due to the following error: Interface wordt niet ondersteund (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))." I've solved this error to declare an object: Dim olContact As Outlook.Link olContact = Item.Links.Item(1) This wil prevent the error An Outlook.Link object, in my case olContact , has the following properties, as you already know ofcourse, Application Class Item Name Parent Session Type In the Name property I can get the Name value (Duh) But what I need is the EntryID value of the Contact Item. This is because I want a unique ID. Multiple Contacts with the exactly the same name can occur in Outlook. Is there a way to get the EntryID of the linked contact(s)?? Thnx for your time again... Dikbill, The Netherlands, |
#6
|
|||
|
|||
![]()
Item should certainly not be an Explorer.
Sorry about that, I've been using Links for so long as MAPI properties I forgot the odd casting you need to get a contact item out of a link. Try this: Dim olContact As Outlook.ContactItem olContact = Item.Links.Item(1).Parent strEntryID = olContact.EntryID strFullName = olContact.FullName etc. That's necessary even though the Type returned for a Link item is 40, which is olContact. Weird but you have to use the Link item's Parent property to get a ContactItem that won't throw an exception for the cast. -- 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 "Dikbill" wrote in message . .. Ken, Thnx again! I've got it working, but....... :-) I get the following error on the instruction oContact = Item.Links.Item(1) In my case Item is the active Explorer! System.InvalidCastException was unhandled by user code Message="Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Outlook.ContactItem'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00063021-0000-0000-C000-000000000046}' failed due to the following error: Interface wordt niet ondersteund (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))." I've solved this error to declare an object: Dim olContact As Outlook.Link olContact = Item.Links.Item(1) This wil prevent the error An Outlook.Link object, in my case olContact , has the following properties, as you already know ofcourse, Application Class Item Name Parent Session Type In the Name property I can get the Name value (Duh) But what I need is the EntryID value of the Contact Item. This is because I want a unique ID. Multiple Contacts with the exactly the same name can occur in Outlook. Is there a way to get the EntryID of the linked contact(s)?? Thnx for your time again... Dikbill, The Netherlands, |
#7
|
|||
|
|||
![]()
Ken,
Thnx but olContact = Item.Links.Item(1).Parent returns the appointment item where the contacts are connected from so olContact will contain the appointment object ;-) Any suggestions?? Tx Dikbill, The Netherlands, "Ken Slovak - [MVP - Outlook]" schreef in bericht ... Item should certainly not be an Explorer. Sorry about that, I've been using Links for so long as MAPI properties I forgot the odd casting you need to get a contact item out of a link. Try this: Dim olContact As Outlook.ContactItem olContact = Item.Links.Item(1).Parent strEntryID = olContact.EntryID strFullName = olContact.FullName etc. That's necessary even though the Type returned for a Link item is 40, which is olContact. Weird but you have to use the Link item's Parent property to get a ContactItem that won't throw an exception for the cast. -- 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 "Dikbill" wrote in message . .. Ken, Thnx again! I've got it working, but....... :-) I get the following error on the instruction oContact = Item.Links.Item(1) In my case Item is the active Explorer! System.InvalidCastException was unhandled by user code Message="Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Outlook.ContactItem'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00063021-0000-0000-C000-000000000046}' failed due to the following error: Interface wordt niet ondersteund (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))." I've solved this error to declare an object: Dim olContact As Outlook.Link olContact = Item.Links.Item(1) This wil prevent the error An Outlook.Link object, in my case olContact , has the following properties, as you already know ofcourse, Application Class Item Name Parent Session Type In the Name property I can get the Name value (Duh) But what I need is the EntryID value of the Contact Item. This is because I want a unique ID. Multiple Contacts with the exactly the same name can occur in Outlook. Is there a way to get the EntryID of the linked contact(s)?? Thnx for your time again... Dikbill, The Netherlands, |
#8
|
|||
|
|||
![]()
You're correct, I tested this here with a contact item so that fooled me.
I'd have to say after looking at it again and reviewing some of my old code that worked with the Links collection that the only thing you're going to be able to get back using the Outlook object model is the name property of the link item. -- 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 "Dikbill" wrote in message . .. Ken, Thnx but olContact = Item.Links.Item(1).Parent returns the appointment item where the contacts are connected from so olContact will contain the appointment object ;-) Any suggestions?? Tx Dikbill, The Netherlands, |
#9
|
|||
|
|||
![]()
Ken,
No worry's :-) Yesterday late in the afternoon I've solved the problem! Item is the filtered Appointment item with some contacts linked to it. Item = olns.GetItemFromID(myAppt.EntryID, StoreID) Dim iLinkItems As Integer = 0 Dim olinkitem As Outlook.Link = Nothing For iLinkItems = 1 To Item.Links.count olinkitem = Item.Links.Item(iLinkItems) MsgBox("EntryID= " & olinkitem.Item.EntryID & " FullName= " & olinkitem.Item.FullName) Next With this code I can get all data from the linked contacts! The most important is the EntryID for identification :-) Thanx for your help and succes with your projects! You've save me a great deal of search time ;-) Dikbill, The Netherlands "Ken Slovak - [MVP - Outlook]" schreef in bericht ... You're correct, I tested this here with a contact item so that fooled me. I'd have to say after looking at it again and reviewing some of my old code that worked with the Links collection that the only thing you're going to be able to get back using the Outlook object model is the name property of the link item. -- 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 "Dikbill" wrote in message . .. Ken, Thnx but olContact = Item.Links.Item(1).Parent returns the appointment item where the contacts are connected from so olContact will contain the appointment object ;-) Any suggestions?? Tx Dikbill, The Netherlands, |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Unable to create new calendar item appointment | Luego | Outlook - General Queries | 0 | June 15th 06 11:05 PM |
Outlook 2003 gets not connected error but status is connected | [email protected] | Outlook - General Queries | 0 | May 28th 06 01:28 AM |
How do I add an item that isn't an appointment? | smags | Outlook - Calandaring | 1 | March 22nd 06 06:35 PM |
Accessing Contacts in an Appointment Item... | Zio Gian | Outlook and VBA | 0 | February 24th 06 12:29 AM |
How to find Appointment Item by EntryID? | deko | Outlook and VBA | 2 | January 23rd 06 07:15 PM |