Saving exception item in recurring appointment item fails

D

Dikbill

Hi there,

I have the following problem,

I have a recurring Outlook appointment item, sheduled for every workday
for two weeks, so 10 appointments in total.
Startdate = 11-07-2006 and the end date is 24-07-2006.
No other items are available in Outlook! (Test environment)
Now I change the subject of one of the items in Outlook and save the item.
Outlook changes the recurring symbol on this item to a recurring symbol with
a line thru it so I asume that's the way of Outlook to show it's an
exception item.

Now I have a VB.net program which communicates with Outlook.
The problem is when I save the one item, all items from the recurring set
will be adjusted and not just the one item :-(

All 10 items for the recurring set will have the same body text.
All 10 items do have the same Entry ID value but I can get the items
seperatly, only when I save one item all 10 items are adjusted.
Outlook must have an (internal) ID for the seperate (10) items???

What am I doing wrong?
Is there a way to save just that one exception item???

Thanx a lot,

Dikbill, The Netherlands
(e-mail address removed)

I use the following code, written in VB 2005 with Outlook 2003 SP2

Dim ol As Outlook.Application
Dim olns As Outlook.NameSpace
Dim Item As Object
Dim StoreID As String

' Set the application object
ol = New Outlook.Application
' Set the namespace object
olns = ol.GetNamespace("MAPI")
Dim objFolder As Outlook.MAPIFolder

Dim objItems As Object = Nothing
Dim strFilter As Object = Nothing
Dim objTest As Object = Nothing
Dim sPersfoldername As String = ""
Dim objFolders As Object = olns.Folders

For Each objFolder In objFolders 'Just a test to get the public
folder name
sPersfoldername = objFolder.Name
Next

sPersfoldername = sPersfoldername & "\Agenda"
objFolder = GetMAPIFolder(sPersfoldername, ol, olns)
objItems = objFolder.Items
objItems.Sort("[Start]")
objItems.IncludeRecurrences = True 'Set to true so I get all
appointments seperately!!

'When you set the property 'IncludeRecurrences ' to true, you can't
use the objTest.items.count
'because it will return the number 2147483647!!!
'See
http://www.microsoft.com/technet/prodtechnol/office/office2000/maintain/featusability/outapp.mspx
'about this feature!

'Here I filter on date so I wil only have 1 item returned!!
strFilter = "[Start] <= " & Quote(DateValue("11-07-2006") & "
23:59") & " And " & _
"[End] > " & Quote(DateValue("11-07-2006") & " 0:00")
Dim myAppt As Outlook.AppointmentItem
Dim strMsg As String = ""

objTest = objItems.Restrict(strFilter)
myAppt = objTest.GetFirst
Dim sPrevEntryID As String = ""
Dim iRecurrCount As Integer = 1
' Get the StoreID, which is a property of the folder
StoreID = objFolder.StoreID

'This loop will be entered only one time in this case!
Do While TypeName(myAppt) <> "Nothing"
strMsg = ""
strMsg = strMsg & vbLf & myAppt.Subject & "Nr:" & iRecurrCount
strMsg = strMsg & " at " & Format(myAppt.Start, "hh:mm") &
vbCrLf
MsgBox(strMsg)
iRecurrCount = iRecurrCount + 1
sPrevEntryID = myAppt.EntryID
Item = olns.GetItemFromID(myAppt.EntryID, StoreID)

'Item.display()
Dim oAgendaItem As Outlook.AppointmentItem = Item
oAgendaItem.Body = "Adjust Body text :)"
oAgendaItem.Save() 'After this statement all 10 items are
adjusted!!!
myAppt = objTest.GetNext
Loop
 
K

Ken Slovak - [MVP - Outlook]

If you get an instance of that appointment and use
GetRecurrencePattern.Parent you get to the master appointment in the series.
Using the GetOccurrence method of the RecurrencePattern object gets you a
single occurrence of that series. The Exceptions collection contains all
exceptions.




Dikbill said:
Hi there,

I have the following problem,

I have a recurring Outlook appointment item, sheduled for every workday
for two weeks, so 10 appointments in total.
Startdate = 11-07-2006 and the end date is 24-07-2006.
No other items are available in Outlook! (Test environment)
Now I change the subject of one of the items in Outlook and save the item.
Outlook changes the recurring symbol on this item to a recurring symbol
with
a line thru it so I asume that's the way of Outlook to show it's an
exception item.

Now I have a VB.net program which communicates with Outlook.
The problem is when I save the one item, all items from the recurring set
will be adjusted and not just the one item :-(

All 10 items for the recurring set will have the same body text.
All 10 items do have the same Entry ID value but I can get the items
seperatly, only when I save one item all 10 items are adjusted.
Outlook must have an (internal) ID for the seperate (10) items???

What am I doing wrong?
Is there a way to save just that one exception item???

Thanx a lot,

Dikbill, The Netherlands
(e-mail address removed)

I use the following code, written in VB 2005 with Outlook 2003 SP2

Dim ol As Outlook.Application
Dim olns As Outlook.NameSpace
Dim Item As Object
Dim StoreID As String

' Set the application object
ol = New Outlook.Application
' Set the namespace object
olns = ol.GetNamespace("MAPI")
Dim objFolder As Outlook.MAPIFolder

Dim objItems As Object = Nothing
Dim strFilter As Object = Nothing
Dim objTest As Object = Nothing
Dim sPersfoldername As String = ""
Dim objFolders As Object = olns.Folders

For Each objFolder In objFolders 'Just a test to get the public
folder name
sPersfoldername = objFolder.Name
Next

sPersfoldername = sPersfoldername & "\Agenda"
objFolder = GetMAPIFolder(sPersfoldername, ol, olns)
objItems = objFolder.Items
objItems.Sort("[Start]")
objItems.IncludeRecurrences = True 'Set to true so I get all
appointments seperately!!

'When you set the property 'IncludeRecurrences ' to true, you can't
use the objTest.items.count
'because it will return the number 2147483647!!!
'See
http://www.microsoft.com/technet/prodtechnol/office/office2000/maintain/featusability/outapp.mspx
'about this feature!

'Here I filter on date so I wil only have 1 item returned!!
strFilter = "[Start] <= " & Quote(DateValue("11-07-2006") & "
23:59") & " And " & _
"[End] > " & Quote(DateValue("11-07-2006") & " 0:00")
Dim myAppt As Outlook.AppointmentItem
Dim strMsg As String = ""

objTest = objItems.Restrict(strFilter)
myAppt = objTest.GetFirst
Dim sPrevEntryID As String = ""
Dim iRecurrCount As Integer = 1
' Get the StoreID, which is a property of the folder
StoreID = objFolder.StoreID

'This loop will be entered only one time in this case!
Do While TypeName(myAppt) <> "Nothing"
strMsg = ""
strMsg = strMsg & vbLf & myAppt.Subject & "Nr:" & iRecurrCount
strMsg = strMsg & " at " & Format(myAppt.Start, "hh:mm") &
vbCrLf
MsgBox(strMsg)
iRecurrCount = iRecurrCount + 1
sPrevEntryID = myAppt.EntryID
Item = olns.GetItemFromID(myAppt.EntryID, StoreID)

'Item.display()
Dim oAgendaItem As Outlook.AppointmentItem = Item
oAgendaItem.Body = "Adjust Body text :)"
oAgendaItem.Save() 'After this statement all 10 items are
adjusted!!!
myAppt = objTest.GetNext
Loop
 
D

Dikbill

Ken,

Thnx a 1000!!
I've used that method and works fine!!

Greetz,

Dikbill, The Netherlands
(e-mail address removed)


Ken Slovak - said:
If you get an instance of that appointment and use
GetRecurrencePattern.Parent you get to the master appointment in the
series. Using the GetOccurrence method of the RecurrencePattern object
gets you a single occurrence of that series. The Exceptions collection
contains all exceptions.




Dikbill said:
Hi there,

I have the following problem,

I have a recurring Outlook appointment item, sheduled for every workday
for two weeks, so 10 appointments in total.
Startdate = 11-07-2006 and the end date is 24-07-2006.
No other items are available in Outlook! (Test environment)
Now I change the subject of one of the items in Outlook and save the
item.
Outlook changes the recurring symbol on this item to a recurring symbol
with
a line thru it so I asume that's the way of Outlook to show it's an
exception item.

Now I have a VB.net program which communicates with Outlook.
The problem is when I save the one item, all items from the recurring set
will be adjusted and not just the one item :-(

All 10 items for the recurring set will have the same body text.
All 10 items do have the same Entry ID value but I can get the items
seperatly, only when I save one item all 10 items are adjusted.
Outlook must have an (internal) ID for the seperate (10) items???

What am I doing wrong?
Is there a way to save just that one exception item???

Thanx a lot,

Dikbill, The Netherlands
(e-mail address removed)

I use the following code, written in VB 2005 with Outlook 2003 SP2

Dim ol As Outlook.Application
Dim olns As Outlook.NameSpace
Dim Item As Object
Dim StoreID As String

' Set the application object
ol = New Outlook.Application
' Set the namespace object
olns = ol.GetNamespace("MAPI")
Dim objFolder As Outlook.MAPIFolder

Dim objItems As Object = Nothing
Dim strFilter As Object = Nothing
Dim objTest As Object = Nothing
Dim sPersfoldername As String = ""
Dim objFolders As Object = olns.Folders

For Each objFolder In objFolders 'Just a test to get the public
folder name
sPersfoldername = objFolder.Name
Next

sPersfoldername = sPersfoldername & "\Agenda"
objFolder = GetMAPIFolder(sPersfoldername, ol, olns)
objItems = objFolder.Items
objItems.Sort("[Start]")
objItems.IncludeRecurrences = True 'Set to true so I get all
appointments seperately!!

'When you set the property 'IncludeRecurrences ' to true, you
can't
use the objTest.items.count
'because it will return the number 2147483647!!!
'See
http://www.microsoft.com/technet/prodtechnol/office/office2000/maintain/featusability/outapp.mspx
'about this feature!

'Here I filter on date so I wil only have 1 item returned!!
strFilter = "[Start] <= " & Quote(DateValue("11-07-2006") & "
23:59") & " And " & _
"[End] > " & Quote(DateValue("11-07-2006") & " 0:00")
Dim myAppt As Outlook.AppointmentItem
Dim strMsg As String = ""

objTest = objItems.Restrict(strFilter)
myAppt = objTest.GetFirst
Dim sPrevEntryID As String = ""
Dim iRecurrCount As Integer = 1
' Get the StoreID, which is a property of the folder
StoreID = objFolder.StoreID

'This loop will be entered only one time in this case!
Do While TypeName(myAppt) <> "Nothing"
strMsg = ""
strMsg = strMsg & vbLf & myAppt.Subject & "Nr:" & iRecurrCount
strMsg = strMsg & " at " & Format(myAppt.Start, "hh:mm") &
vbCrLf
MsgBox(strMsg)
iRecurrCount = iRecurrCount + 1
sPrevEntryID = myAppt.EntryID
Item = olns.GetItemFromID(myAppt.EntryID, StoreID)

'Item.display()
Dim oAgendaItem As Outlook.AppointmentItem = Item
oAgendaItem.Body = "Adjust Body text :)"
oAgendaItem.Save() 'After this statement all 10 items are
adjusted!!!
myAppt = objTest.GetNext
Loop
 

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