MAPI Filter on GlobalAppointmentID

J

Jason

Hi,

I updating an office addin that supports both Office 2003 and 2007. I
understand 2007 outlook interop now includes the GlobalAppointmentID so I am
NOT asking for help with 2007, I have that handled.. I am working on the 2003
assembly and have had to resort to some MAPI code for grabing the
GlobalAppointmentID from a created appointment. This works great and again,
all is well.

Now I am trying to Edit an existing appointment and need to locate the
calendar item using the Global ID. As it's not available in the interop I am
trying to use MAPI.

The following Code gets executed. MeetingUniqueID is a string and contains
the GlobalAppointmentID

Dim oMapiSession As New MAPI.Session
oMapiSession.Logon("", "", False, False)

Dim oFolder As MAPI.Folder =
CType(oMapiSession.GetDefaultFolder(MAPI.CdoDefaultFolderTypes.CdoDefaultFolderCalendar), MAPI.Folder)
Dim oMessages As MAPI.Messages = CType(oFolder.Messages, MAPI.Messages)
Dim oFilter As MAPI.MessageFilter = CType(oMessages.Filter,
MAPI.MessageFilter)

Dim oFields As MAPI.Fields = CType(oFilter.Fields, MAPI.Fields)
oFields.Add("GlobalAppointmentID", MAPI.CdoFieldType.CdoString,
MeetingUniqueID)

When I execute getFirst() on the messages I receive a MAPI_TOO_COMPLEX
error. Can you tell me how I can use the GlobalAppointmentID in a filter?? I
absolutely do not want to crawl through 1000's of calendar items to find the
one I want..

I'm hoping you can help??

Thanks
Jason
 
J

Jialiang Ge [MSFT]

Hello Jason,

The reason for the error "CDO_E_TOO_COMPLEX" in this case is documented at:
http://support.microsoft.com/kb/192404/en-us
<quote>
Setting the CdoPR_START_DATE in a MessageFilter on AppointmentItems returns
items that start on or before the specified date. Setting the
CdoPR_END_DATE returns items that end on or after that date. Attempting to
specify other properties to filter on or trying to set one of these
properties but not the other results in an error of CDO_E_TOO_COMPLEX.
</quote>

The recommended approach it get appointment item from its global object ID
can be found at:
http://support.microsoft.com/kb/899919/en-us
This article provides the information about GetItemFromID: However, using
an Entry ID to locate an item may become unreliable after SP2 or a later
service pack is installed. In addition, it demonstrates how to use Global
Object ID to retrieve the appointment item.

Please have a try and let me know whether it works for you.

In addition to that, here are some resources for you to look at whenever
you find free time. You might have come across these before but it is just
for your reference.

1. <http://support.microsoft.com/kb/200018/en-us>
2. <http://support.microsoft.com/kb/266353>
3.
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mapi/html/
ce041
344-975b-4842-8f2a-af14479792a9.asp>
4. <http://support.microsoft.com/default.aspx?scid=kb;en-us;291794>
5.
<http://www.microsoft.com/technet/archive/exchangeserver55/maintain/cdordmap
..mspx
?mfr=true>
6. <http://support.microsoft.com/?id=288836>
7. <http://www.com.it-berater.org/COM/mapi/mapi.htm>
8. <http://support.microsoft.com/default.aspx?scid=kb;en-us;320071>
9. http://support.microsoft.com/kb/178508

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top