• Creator
    Topic
  • #4102
    Shimonek
    Participant

    My boss has asked for the ability to filter items marked personal out of a list but maintain everything else. The problem is that he doesn’t want to have to change the category on everything else in order to accomplish this.

    I would like to create an applet that will set a default category for new items. I have figured out how to read the category from a Msg but I cannot figure out how to set the category. Any help would be much appreciated (and probably result in me buying your product ;-)

  • Author
    Replies
  • #7111
    Support 1a
    Participant

    Thank you for your question. By ‘new items’, do you mean new messages that arrive in the mailbox, or do you mean items that the user creates?

    In order to set a category, you first need to grab an instance of the category object from the category definitions collection in the account:

    for each oCategoryDef in GroupWise.Account.CategoryDefinitions
        if (iCategoryName = ucase(oCategoryDef.Name)) then
          set aCategory = oCategoryDef
          exit function
        end if
      next
    

    Then, given an instance of a message object, you add the category object as shown here:

    oMsg.Categories.add(aCategory)

    As I alluded to above, the devil is in the detail regarding the scenario under which you want to add the category.

    I hope this helps.

    Advansys Support

    #7109
    Shimonek
    Participant

    Thank you for the prompt response. I am very impressed.

    For this to work the way I envision both newly received and newly created items would need to have a category set. I think I can meld your example into the hello world example and get it to work for newly received items.

    I am unsure of the best way to proceed with newly created items. I only want to set the category if the user does not set it themself. Is there an event that I can use that will detect new items of any type after they have been added? Would it make more sense to set the category before it is sent or posted?

    Thanks again!

    #7110
    Support 1a
    Participant

    For messages the user creates, I would suggest the OnSend event. From that point you should be able to access the CommandMessage’s categories collection, ennumerate it to see if the user has set a category, and update the category if required.

    You could also try the OnCompose event, but that wouldn’t give the user the opportunity to set a category themselves.

    I hope this helps,

    Advansys Support

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.