A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to change Categories property of recurring apointment?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 22nd 06, 03:17 AM posted to microsoft.public.outlook.program_vba
deko
external usenet poster
 
Posts: 15
Default How to change Categories property of recurring apointment?

When attempting to change the Categories property of a recurring
appointment, I get this error:

Error Number -1179631611: This property cannot be changed for a single
instance of a recurring meeting.

So how do I change the Categories property of the object that represents the
series?

In pseudo code, it might look like this:

Dim objItems as Object
Dim olai As Outlook.AppointmentItem
Dim olitms As Outlook.Items
Set objItems = olitms.Restrict(strCriteria)

For Each olai In objItems
If olai.IsRecurring Then
'how to get the series object???
olai.SeriesObject.Categories = strNewCategory '== pseudo code
Else
olai.Categories = strNewCategory
End if
Next

Thanks in advance.

Ads
  #2  
Old January 22nd 06, 02:32 PM posted to microsoft.public.outlook.program_vba
deko
external usenet poster
 
Posts: 15
Default How to change Categories property of recurring apointment?

One complication is that I'm trying to do this inside a For Each loop - of
all appointments, including recurrences. I don't know of any way to get the
"parent" or "series" AppointmentItem when I've included recurrences in the
collection, so I get the whole items collection again (within the outer
loop) and this time do not get recurrences. Then I restrict it and loop
through the items looking for the EntryID in question. Then I can change
the Categories property. Seems like a lot of code... but it works.

Dim olai As Outlook.AppointmentItem
For Each olai in objItems

If Len(olai.Categories) 0 Then 'we want to update the category
lngCid = Nz(DLookup("Cat_ID", "tblEntity", _
"Entity_ID = " & olai.BillingInformation))
strCategoryName = Nz(DLookup("CatName", "tblCategory", _
"Cat_ID = " & lngCid))

If olai.IsRecurring Then
strEntryID = olai.EntryID
Set olRitms = olns.GetDefaultFolder(olFolderCalendar).Items
strFilter = "[BillingInformation] = " & QT & olai.BillingInformation
& QT
Set objRcr = olRitms.Restrict(strFilter)
i = 0
Do While i objRcr.Count
i = i + 1
If objRcr(i).EntryID = strEntryID Then
'Debug.Print objRcr(i).Subject & ": " & objRcr(i).Categories
objRcr(i).Categories = strCategoryName
objRcr(i).Save
End If
Loop
Else
olai.Categories = strCategoryName
End If

Next

  #3  
Old January 23rd 06, 05:32 AM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default How to change Categories property of recurring apointment?

Use the AppointmentItem.RecurrenceState property to work only with the
master appointments (olApptMaster or olApptNotRecurring)

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"deko" wrote in message
...
When attempting to change the Categories property of a recurring
appointment, I get this error:

Error Number -1179631611: This property cannot be changed for a single
instance of a recurring meeting.

So how do I change the Categories property of the object that represents
the series?

In pseudo code, it might look like this:

Dim objItems as Object
Dim olai As Outlook.AppointmentItem
Dim olitms As Outlook.Items
Set objItems = olitms.Restrict(strCriteria)

For Each olai In objItems
If olai.IsRecurring Then
'how to get the series object???
olai.SeriesObject.Categories = strNewCategory '== pseudo code
Else
olai.Categories = strNewCategory
End if
Next

Thanks in advance.



  #4  
Old January 23rd 06, 06:18 AM posted to microsoft.public.outlook.program_vba
deko
external usenet poster
 
Posts: 15
Default How to change Categories property of recurring apointment?

Use the AppointmentItem.RecurrenceState property to work only with the
master appointments (olApptMaster or olApptNotRecurring)


Much better! Thanks for the tip!

If olai.Categories strNewCategoryName Then
If olai.IsRecurring Then
If olai.RecurrenceState = olApptMaster Then
olai.Categories = strNewCategoryName
End If
Else
olai.Categories = strNewCategoryName
End If
End If

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I change the meeting organizer (recurring mtg) in Outlook? PamImp Outlook - Calandaring 0 March 3rd 06 07:14 PM
Background Color for Outlook Property Page paulmcd Add-ins for Outlook 2 February 15th 06 07:38 AM
How to validate a Custom Property Page Jack Zhang Add-ins for Outlook 1 February 9th 06 07:22 PM
"Resize with form" property on custom controls Vaughan Outlook - Using Forms 2 February 6th 06 08:03 PM
Can I change Outlook recurring event defaults? Jobsworth Outlook - Calandaring 1 February 5th 06 02:00 AM


All times are GMT +1. The time now is 03:26 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.