/ Forums / Advansys Formativ / Creating Solutions with Formativ / Remote access of GroupWise Address Book

  • Creator
    Topic
  • #4437
    ctaleck
    Participant

    I am trying to retrieve some data from the GroupWise Address Book. However, I have ran in to an issue when the user is using the GroupWise client in a remote setting. The data seems to be not available. Are there any techniques to enable access to this data?


    Sub Main(Client)
    Msgbox GetGWABField(GroupWise.Account.Owner, "Office Phone Number")
    End Sub

    Function GetGWABField(objItem, strField)
    Dim objABEntry, objAddressBook, objFields, objFieldData
    Set objAddressBook = Groupwise.Account.Addressbooks.Item("Novell GroupWise Address Book")
    '
    ' objABEntry is not created in remote setting
    '
    Set objABEntry = objAddressBook.AddressBookEntries.Item(objItem)
    Set objFields = objABEntry.Fields
    On Error Resume Next
    Set objFieldData = objFields(strField, fgwString)
    If Err = 0 Then
    GetGWABField = objFieldData.Value
    Else
    Err.Clear
    GetGWABField = ""
    End If
    Set objFieldData = Nothing
    Set objFields = Nothing
    Set objABEntry = Nothing
    Set objAddressBook = Nothing
    End Function
  • Author
    Replies
  • #8178
    Support 3
    Participant

    Sorry for the delay.

    Following code able to access ‘Office Phone Number’ in remote mode. This code used AddressBookEntries.Find() method to access the entry. Its a known behaviour that System Address Book supports a different set of filtering operations.

    This code will match all entries with display name so if you have multiple entries with same display name then you could iterate entries where email address matches.

      
    Sub Main(Client, GWEvent)
    
      msgbox GetGWABField(GroupWise.Account.Owner, "Office Phone Number")
    
    End Sub
    
    
    Function GetGWABField(oAddress, strField)
    
      Dim oField
      dim oEntry
      dim oEntries
      dim objAddressBook
    
      GetGWABField = ""
      Set objAddressBook = Groupwise.Account.Addressbooks.Item("Novell GroupWise Address Book")
    
      iFilter = "(Name MATCHES """ & oAddress.displayname & """)"
    
      Set oEntries = objAddressBook.AddressBookEntries.Find(iFilter)
    
      if (not oEntries is nothing) then
        if (oEntries.count > 0) then
          set oEntry = oEntries.item(1)
          if (not oEntry is nothing) then
            on error resume next
            Set oField = oEntry.fields(strField, fgwString)
            If err = 0 Then
               GetGWABField = oField.Value
            else
              err.Clear
            end if
          end if
        end if
      end if
    
      Set oField = Nothing
      Set oEntry = Nothing
      Set oEntries = Nothing
      Set objAddressBook = Nothing
    
    End Function
    
    

    Hope this helps.

    Regards,
    Advansys Support

    #8176
    ctaleck
    Participant

    Thank you for confirming that the “Item” method is not supported in some situations.

    I used a the “Find” method as well and it works.

    Thank you.

    #8177
    Support 3
    Participant

    Great, thanks for letting us know and glad it was of assistance.

    Regards,
    Advansys Support

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