Redemption Utils: Can't save follow up time

  • Thread starter Thread starter Jack Harris
  • Start date Start date
J

Jack Harris

We've been trying to set a follow up reminder in an Outlook contact.
Using Outlook Spy we found that when you use the dialog box in Outlook
the following properties get set:
Flag Due By
Flag Due By Next
Flag Status
Reply Time
Reply Requested
Response Requested
Reminder Set

We have been unable to get any of the properties to save, except for
due by, due by next and flag status. Any help we can get would be
appreciated.

Jack Harris
Seminars and Systems

Here's some code from our test program that shows what we are trying
to do.

Private Sub setRemindTime_Click()
Dim objContact As Outlook.ContactItem

Dim objSelection As Outlook.Selection
Dim tmp As String
Dim flag As Long
Dim utils

Dim PropSetId4 As String
Dim PropSetId2 As String
PropSetId4 = "{00062008-0000-0000-C000-000000000046}"
PropSetId2 = "{00062003-0000-0000-C000-000000000046}"

On Error GoTo ErrorHandler

Set utils = CreateObject("Redemption.MAPIUtils")

If objExplorer.CurrentFolder =
objOutlook.GetNamespace("MAPI").GetDefaultFolder(olFolderContacts)
Then
Set objSelection = objExplorer.Selection
Set objContact = objSelection.Item(1)

' Passed a date string in the format 11/15/2003 5:00:00 AM
tmp = txtRemindTime.Text

Dim Time, Request
Dim PrReminderTime, ReminderTime
Dim PrFlagDueBy, FlagDueBy
Dim PrReminderSet, ReminderSet

Dim PrFlagStatus, PrReplyRequested, PrResponseRequested,
PrReplyTime
PrFlagStatus = &H10900003
PrReplyRequested = 202833931
PrResponseRequested = 6488075
PrReplyTime = 3145792

PrFlagDueBy = utils.GetIDsFromNames(objContact.MAPIOBJECT,
PropSetId4, &H8517, True)
PrFlagDueBy = PrFlagDueBy + &H40
PrReminderTime = utils.GetIDsFromNames(objContact.MAPIOBJECT,
PropSetId4, &H8502, True)
PrReminderTime = PrReminderTime + &H40

PrReminderSet = utils.GetIDsFromNames(objContact.MAPIOBJECT,
PropSetId4, &H8503)
PrReminderSet = PrReminderSet + &HB

Time = CDate(tmp)
Request = True

utils.HrSetOneProp objContact.MAPIOBJECT, PrFlagDueBy, Time,
True
utils.HrSetOneProp objContact.MAPIOBJECT, PrReminderTime,
Time, True

utils.HrSetOneProp objContact.MAPIOBJECT, PrFlagStatus,
CInt(2), True
utils.HrSetOneProp objContact.MAPIOBJECT, PrReplyRequested,
Request, True
utils.HrSetOneProp objContact.MAPIOBJECT, PrResponseRequested,
Request, True
utils.HrSetOneProp objContact.MAPIOBJECT, PrReplyTime, Time,
True
' Do save here
utils.HrSetOneProp objContact.MAPIOBJECT, PrReminderSet,
CInt(1), True

Set utils = Nothing
Else
MsgBox "Select the contact folder and then a contact"
End If
Exit Sub
ErrorHandler:
MsgBox "Error setting Reminder: " & Err.Description
End Sub
 
1. Can you read these properties right back using MAPIUtils.HrGetOneProp
after calling HrSetOneProp
2. What if you use SafeContactItem instead and set theproperties using
SafeContactItem.Fields() instead?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
PrReminderSet = PrReminderSet + &HB looks wrong. &HB should be OR'd
with the tag.

For ReminderSet (PR_REMINDER) code I use would look something like
this:

Dim rdmMessage As Redemption.MessageItem
Dim PR_Reminder As Long

Const MAPI_REMINDER_PROPSET = "{00062008-0000-0000-C000-000000000046}"

Set rdmFolder = CreateObject("Redemption.MAPIFolder")

rdmFolder.Item = oOLFolder 'a Contacts folder (Outlook.MAPIFolder)
Set rdmItems = rdmFolder.Items
Set rdmMessage = rdmItems.Item(1)

PR_Reminder = rdmMessage.GetIDsFromNames(MAPI_REMINDER_PROPSET, _
&H8503) Or &HB

That would give the property tag (long) needed to access that property
using the Fields collection of a Redemption item.
 
I've run some tests using Reminder Set several different ways:

1. Using MAPIUtils.HrSetOneProp
I can set the property and read it back using MAPIUtils.HrGetOneProp,
but
the property does not save, even though the bSave param is set to
true.

2. Using SafeContactItem
The same as the above - I can set and read back the property, but it
doesn't save. I didn't have any luck using the SaveAs method, but I
could be doing something wrong here.

3. Using MessageItem
I can set and read back the property - and it saves.

In both 1 & 2 I used the MAPIOBJECT provided by
Outlook.Explorer.Selection.
In 3 I had to iterate the collection to find the appropriate property.

We can use method 3 to do the job, but it would be much better if we
could
find the currently selected item directly.

Thanks again for the help
Jack Harris
 
You could always use a Redemption.MAPITable filter to get any items
that have PR_Reminder set. That's what I do. I use code like this
after getting the UID for the property since it would vary depending
on the store provider:

rdmTable.Item = oFolder.Items
Set rdmFilter = rdmTable.Filter
rdmFilter.Clear
Set rdmRestrictProp = rdmFilter.SetKind(RES_PROPERTY)
rdmRestrictProp.ulPropTag = PR_Reminder
rdmRestrictProp.relop = RELOP_EQ
rdmRestrictProp.lpProp = True
rdmFilter.Restrict

Then I use GetRows (depending on the number of rows, if more than 100
I just get 100 at a clip) to get any items with PR_Reminder set.

I haven't been using HrSetOneProp, I've been setting PR_Reminder by
using CDO code for that. I use the Add method for the Fields
collection of the item to add that prop to the item. Are you saving
the item that you are using HrSetOneProp on? Another thing to try
would be to dirty the underlying Outlook item to make sure that
Outlook flushes its item cache. Something like Item.Subject =
Item.Subject.
 
Ken,
What we are doing is allowing the user to select a contact and then
associating an action plan with that contact. Setting
reminders/follow-ups is just the part that we've been having trouble
with.

I've managed to get around the selection problem by getting the
selection from the Outlook explorer:
Set objSelection = objExplorer.Selection
Set objContact = objSelection.Item(1)

Then iterate through the SafeItems collection looking for the item
with the same EntryID.

Then I use the MessageItem to set/modify the properties and save it.
This method works. It isn't pretty, but it does get the job done.

I'm still a little fuzzy on how to use SafeContactItem.SaveAs (there
does not appear to be a Save method on this and several other safe
objects).

Thanks for the help
Jack Harris
 
Safe*Item objects in Redemption only implement properties and methods
blocked by the security patch - since Save is not blocked, Redemption does
not implement it. You can call Save on the original OOM object assigned to
the Safe*Item.Item property, or you can dim Safe*Item as a generic Object to
force the late binding - at run-time Redemption will forward the calls to
methods and properties that it does not implement to the OOM object.

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


Jack Harris said:
Ken,
What we are doing is allowing the user to select a contact and then
associating an action plan with that contact. Setting
reminders/follow-ups is just the part that we've been having trouble
with.

I've managed to get around the selection problem by getting the
selection from the Outlook explorer:
Set objSelection = objExplorer.Selection
Set objContact = objSelection.Item(1)

Then iterate through the SafeItems collection looking for the item
with the same EntryID.

Then I use the MessageItem to set/modify the properties and save it.
This method works. It isn't pretty, but it does get the job done.

I'm still a little fuzzy on how to use SafeContactItem.SaveAs (there
does not appear to be a Save method on this and several other safe
objects).

Thanks for the help
Jack Harris


"Ken Slovak - [MVP - Outlook]" <[email protected]> wrote in message
You could always use a Redemption.MAPITable filter to get any items
that have PR_Reminder set. That's what I do. I use code like this
after getting the UID for the property since it would vary depending
on the store provider:

rdmTable.Item = oFolder.Items
Set rdmFilter = rdmTable.Filter
rdmFilter.Clear
Set rdmRestrictProp = rdmFilter.SetKind(RES_PROPERTY)
rdmRestrictProp.ulPropTag = PR_Reminder
rdmRestrictProp.relop = RELOP_EQ
rdmRestrictProp.lpProp = True
rdmFilter.Restrict

Then I use GetRows (depending on the number of rows, if more than 100
I just get 100 at a clip) to get any items with PR_Reminder set.

I haven't been using HrSetOneProp, I've been setting PR_Reminder by
using CDO code for that. I use the Add method for the Fields
collection of the item to add that prop to the item. Are you saving
the item that you are using HrSetOneProp on? Another thing to try
would be to dirty the underlying Outlook item to make sure that
Outlook flushes its item cache. Something like Item.Subject =
Item.Subject.
 
Back
Top