• Creator
    Topic
  • #4191
    Immi
    Participant

    Hi,

    How can I access the ‘ExpandedRecipients’ property of the composing message?
    In Novells documentation it says:
    ‘ … For draft messages, expansion of the groups occurs when this property is accessed. …”

    How can I access it…???

    The following code works:

    ‘ this works (but that’s not what I need!)
    Set oMsg = Client.clientstate.commandmessage

    ‘ this does not work:
    ‘Set oMsg = GroupWise.ComposingItem

    Call MsgBox (“Subject: ” & oMsg.Subject & vbCrLf & “FromText: ” & oMsg.FromText & vbCrLf & “BodyText: ” & oMsg.BodyText & vbCrLf)

    Set oRecipients = oMsg.ExpandedRecipients

    For Each oRecipient in oRecipients
    If IsExternalDomain(oRecipient.EmailAddress) Then
    MsgBox “External address detected!”
    End If
    Next

    Regards

    Stephan

  • Author
    Replies
  • #7434
    Support 1a
    Participant

    ExpandedRecipients is a property of the Mail object in the Object API. Like all Object API objects, you cannot use them until a message physically exists in the data store. In other words, you cannot create a message in the GroupWise client and expect any Object API methods to work until the message has at least been saved as a draft message. (Hence to the reference to the draft messages in the documentation).

    Here’s some sample code that saves a composing item as a draft message, then displays the value of the ExpandedRecipients property. Please note this is sample code, not production code.

      dim oMsg
      dim iMsgID
      dim iWIPPath
     
      ' Save the draft message to the Work in Progress folder
      iWIPPath = GroupWise.Account.Owner.DisplayName & "" & GroupWise.Account.WorkFolder.Name
      groupwise.ItemSaveMessageDraft(iWIPPath)
     
      ' Calling ItemMessageIDFromView immediately after GroupWise.ItemSaveMessageDraft
      ' can result in an X00 ID.
      iMsgID = GroupWise.ItemMessageIDFromView
      iBreakCount = 0
      while (iMsgID = "Token failed execution!") or (iMsgID = "X00")
         Application.ProcessMessages
         utilities.Timer(1)
         Application.ProcessMessages
         iMsgID = GroupWise.ItemMessageIDFromView
         iBreakCount = iBreakCount + 1
         if (iBreakCount > 10) then
           exit sub
         end if
      wend
     
      set oMsg = GroupWise.Account.GetMessage(iMsgID)
      Set oRecipients = oMsg.ExpandedRecipients
     
      For Each oRecipient in oRecipients
        msgbox oRecipient.displayname
      Next
     
      set oMsg = nothing
    

    Advansys Support

    #7433
    Immi
    Participant

    Hi!

    I have used some of your sample code with limited success.

    ‘iWIPPath = GroupWise.Account.Owner.DisplayName & “” & GroupWise.Account.WorkFolder.Name’

    If the workFolder is in a subfolder, then it fails. How can I build a complete folder-path for ‘groupwise.ItemSaveMessageDraft(iWIPPath)’ ?

    BTW: The help-file does not contain a section ‘GroupWise.FolderCreate’

    TIA
    Stephan

    #7430
    MA
    Participant

    quote:


    Originally posted by Immi:
    If the workFolder is in a subfolder, then it fails. How can I build a complete folder-path for ‘groupwise.ItemSaveMessageDraft(iWIPPath)’ ?


    The following recursive function will return the full path of the Work-In-Progress folder.

    Sub Main(Client, GWEvent)

    dim iWIPFolderPath

    ‘ Account refresh required if you have moved the WIP folder in current session.
    groupwise.account.refresh
    call GetWIPFolderPath(groupwise.account.workfolder, iWIPFolderPath)

    msgbox iWIPFolderPath

    End Sub

    ‘ Get full path of the Work-In-Progress folder
    function GetWIPFolderPath(aGWFolder, byref aPath)

    if aGWFolder is nothing then
    exit function
    end if

    if (aPath <> “”) then
    aPath = aGWFolder.name & “” & aPath
    else
    aPath = aGWFolder.name
    end if

    if (aGWFolder.objtype = fgwRoot) then
    exit function
    else
    call GetWIPFolderPath(aGWFolder.ParentFolder, aPath)
    end if

    end function

    Thanks
    MA

    #7431
    Support 1a
    Participant

    Thanks MA.

    I’ve made a note regarding the missing reference in the Language Guide.

    Advansys Support

    #7427
    Immi
    Participant

    Hi!

    I have acome one intresting fact:

    The Formativ statements CurrentItem.To_, CurrentItem.CC and CurrentItem.BC do actually do a full address book resolution.

    Thats how I detected this:

    1. Add simple code to an ‘before OnSend’ applet

    Sub Main(Client, GWEvent)
    Set Msg = GroupWise.ComposingItem
    If Msg.To_ & Msg.CC & Msg.BC = “” Then Exit Sub ‘ No recipients
    … your code here…
    Exit Sub

    2. Create a new message with only INVALID address (e.g. asdfg) in the To line and press send. You will get an address resolution error dialog!

    Unfortunately there is no way of retrieving the just resolved addresses… any chances to implement this in a future version of formativ?

    Stephan

    #7429
    Support 1a
    Participant

    The methods you mention are wrappers around GroupWise API functions. Unfortunately we can’t add new core functionality to the client – we can only add an abstraction layer that makes it easier to access the underlying API.

    That being said, have you looked at GroupWise.AddressBookResolveFullName()? The Formativ implementation is a warpper around the following GroupWise token:

    http://developer.novell.com/ndk/doc/gwtoken/gwtokens/data/h6g2rtlu.html#h6g2rtlu

    Advansys Support

    #7425
    Immi
    Participant

    Hi,

    Yes, I have tries using
    GroupWise.AddressBookResolveFullName()

    But that’s no good for me. GroupWise.AddressBookResolveFullName() is only working through the address books that are included in the NameCompletionSearchOrder list.

    Let’s assume this: You click reply on a message from ‘John Doe <john.doe@something.com> (John Doe is not in any address books)

    In the To: field you will see ‘Doe, John <something.com>’.

    Unfortunatly Msg.To_ will ony return ‘Doe, John’ and the true internet address missing.

    There is no way I can resolve the internet address for him using GroupWise.AddressBookResolveFullName().

    Can you tell me what API call Formativ is using for retrieving the value of the Msg.To_ field?

    Stephan

    #7428
    Support 1a
    Participant

    Msg.To_ is a wrapper around the token ‘ItemGetText()’, using ‘X00’ as the message ID.

    Given AddressBookResolveFullName() does not work for you, I suspect you may need to submit an enhancement request to Novell. Unfortunately third parties are unable to add this type of functionality.

    Regards,

    Advansys Support

    #7426
    andremor
    Participant

    hi.
    i’m trying to get “ItemMessageIDFromView()” to work after saving the msg as a draft, but even using the routine above i always get id X00.. any idea?

    #7432
    Support 3
    Participant

    You should get a proper message ID once the message is saved to the message store. Make sure the message is saved in the target folder (i.e. “Work In Progress”).

    Regards,
    Advansys Support

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