| | Awarded by Microsoft since 2005: |  |
| | VBOffice Info | | Visitors | 1389424 | | Impressions | 5089172 |
| |
|
| |
| Author: Michael Bauer | Homepage | | Date: 19.01.2006 | Accessed: 17241 | | | | Description
We are very sorry! This description is not translated yet. Anyway, please try the code as it is self-explanatory. |
Public Sub FlagContactItem(oContact As Outlook.ContactItem, _
ByVal lFlagStatus As Long, _
ByVal dtFlagDueBy As Date, _
sFlagText As String _
)
Dim oMsg As MAPI.Message
Dim oFields As MAPI.Fields
Const CdoPropSetID4 As String = "0820060000000000C000000000000046"
Const CdoPR_FLAG_STATUS As Long = &H10900003
Const CdoPR_FLAG_DUE_BY As String = "{" & CdoPropSetID4 & "}" & "0x8502"
Const CdoPR_FLAG_TEXT As String = "{" & CdoPropSetID4 & "}" & "0x8530"
Set oMsg = GetMessage(oContact)
Set oFields = oMsg.Fields
Select Case lFlagStatus
Case 0
DeleteField oFields, CdoPR_FLAG_STATUS
DeleteField oFields, CdoPR_FLAG_DUE_BY
DeleteField oFields, CdoPR_FLAG_TEXT
Case 1
AddField oFields, CdoPR_FLAG_STATUS, vbLong, lFlagStatus
Case 2
AddField oFields, CdoPR_FLAG_STATUS, vbLong, lFlagStatus
AddField oFields, CdoPR_FLAG_DUE_BY, vbDate, dtFlagDueBy
AddField oFields, CdoPR_FLAG_TEXT, vbString, sFlagText
End Select
oMsg.Update True
End Sub
Private Sub AddField(oFields As MAPI.Fields, _
PropTag As Variant, _
DataType As Variant, _
Value As Variant _
)
On Error Resume Next
Dim oField As MAPI.Field
Set oField = oFields(PropTag)
If oField Is Nothing Then
Set oField = oFields.Add(PropTag, DataType)
End If
oField.Value = Value
End Sub
Private Sub DeleteField(oFields As MAPI.Fields, _
PropTag As Variant _
)
On Error Resume Next
Dim oField As MAPI.Field
Set oField = oFields(PropTag)
If Not oField Is Nothing Then
oField.Delete
End If
End Sub
|
| | |
| | |  | ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the ... [more] |
| | |  | Access the master category list in the blink of an eye, share your categories in a network, get a reminder service, and ... [more] |
| | |  | SAM automatically sets the sender, signature, and folder for sent items, for instance based on the recipient ... [more] |
| | |  | OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or ... [more] |
| |
|