Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to change the class of a task item? (2003)

    I have the following code to change the class of some task items:
    ub ChangeClassTask()


    Dim fdrTasks As Outlook.MAPIFolder
    Dim itmTask As Outlook.TaskItem

    Set fdrTasks = Application.GetNamespace("MAPI").GetDefaultFolder( olFolderTasks)

    For i = 1 To fdrTasks.Items.Count
    Set itmTask = fdrTasks.Items(i)
    If itmTask.Class <> "IPM.Task" Then
    itmTask.Class = "IPM.TAsk"
    itmTask.Save
    End If
    Next i

    End Sub

    I receive an error message saying that the property Class is read only. How can I change the Class property?

    Marcel

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: How to change the class of a task item? (2003)

    Poking around in the Object Browser and Help, it appears that:
    1. <LI>Class is a numeric value, and is read-only.

      <LI>MessageClass is a text value similar to "IPM.Task" that relates to the "form" associated with the item and is read/write.
    Now, in my test with an old mail message, changing the form to the default ("IPM.Mail") and then calling the Save method changed the icon from the custom Note-like one to the normal envelope one. But when I opened the message, it still had the special tabs associated with the form. So I have no idea what changing the MessageClass actually does. Maybe some Googling would clarify...

    Hope this helps.

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to change the class of a task item? (2003)

    I mixed up Class and MessageClass. I have change Class with MessageClass in my code and it has worked.

    Thank you for your help.

    Marcel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •