setting a category for mail object

Hello,

i have been trying to use the object api for setting a category on a selected mail.

After some research, my question is: Is this even possible with the object api and if so, how? :)

( i am using a C3PO and the ClientState.Selected Messages. I then convert the SelectedMessages into a MessageList and so on. I'm not sure if this is the correct way)


Thanks in Advance!

Tags:

  • On 6/25/2013 2:56 AM, AlexWerner wrote:
    >
    > Hello,
    >
    > i have been trying to use the object api for setting a category on a
    > selected mail.
    >
    > After some research, my question is: Is this even possible with the
    > object api and if so, how? :)
    >
    > ( i am using a C3PO and the ClientState.Selected Messages. I then
    > convert the SelectedMessages into a MessageList and so on. I'm not sure
    > if this is the correct way)
    >
    >
    > Thanks in Advance!
    >
    >

    YEs it is possible. But Message is a base class. Not all messages can
    have categories

    Loops through the messages for example and if the className property
    STARTS with GW.MESSAGE.MAIL you can cast to Mail object

    which itself contains a Categories collection you can loop through, add,
    and remove items from.

  • Thank you very much for the help, but i am stuck again:

    after casting, the mail class seems to not have a categories property. To which class of the several should i cast the message into (Mail , MailClass, Mail5Class, Mail8Class) ?
  • I cannot edit my post for some reason. Thanks again for the suggestions, i now have Mail object with access to the 'categories' field. But now i can't figure out how to actually add the category since i get errors for whichever category type i am using. I will keep trying and report back when i managed to set a category.
  • Update:

    So far i have not been able to set a category to a mail object.

    I am able to display the already set categories.


    The Add-Method of the categories collection asks for a category defintion but i can't figure out how to create one. Simply instantiating a category definition object doesn't work because of COM/Interop.


    Any help would be greatly appreciated.
  • If I remember correctly, each GW account can define their own custom set
    of categories in the GW Client or by ObjAPI.

    So, either ..
    * create a new Category definition in the GUI (right click on msg,
    "categories" .. "more" .. "new category"), or
    * use the ObjAPI: Account.CategoryDefinitions.Add( )

    Good luck

    Wolfgang


    On 29.07.2013 07:46, AlexWerner wrote:
    >
    > Update:
    >
    > So far i have not been able to set a category to a mail object.
    >
    > I am able to display the already set categories.
    >
    >
    > The Add-Method of the categories collection asks for a category
    > defintion but i can't figure out how to create one. Simply instantiating
    > a category definition object doesn't work because of COM/Interop.
    >
    >
    > Any help would be greatly appreciated.
    >
    >