/ Forums / Advansys Formativ / Creating Solutions with Formativ / Address Book Rights and Multiple Addresses

  • Creator
    Topic
  • #4140
    RPP
    Participant

    Hi

    I am trying to perform an update to the user’s address books because we are renaming our TFS Gateway. I need to know 2 things to allow me to use Formativ to do this.

    1) How do I tell what rights I have over an address book? I need to be sure I have read/write access to even both looking at the entries.

    Users may have changed their address books configuration and content (e.g. proxied a read-only view to someone else) so I can’t rely on the address book’s name or ‘position’.

    The code I am using to get each book is …

    Set gwBooks = GroupWise.AddressBooks

    For Each gwBook in gwBooks

    Next

    2) I can find and change both the displayname and the default email address but how do I get to an additional email addresses a user may have? I feel it should be the EmailAddresses collection (which works in VB) but Formativ won’t let me use that collection.

    The code to get each address book entry …

    For Each gwEntry in gwBook

    Next

    I have successfully produced this application in VB as a test but it runs very slowly. So far it appears Formativ can do the same task much much faster but I just need to finalise accessing the books and email addresses.

    Thanks

    Simon

  • Author
    Replies
  • #7250
    Support 1a
    Participant

    In regards to question (2) above, here’s some code that may help:

      dim oBook
      dim oEntry
      dim oMailAddress
      dim iEmailAddresses
     
      set oBook = groupwise.account.addressbooks.item("Test")
     
      ' Iterate through each Address Book Entry
      for each oEntry in oBook.AddressBookEntries
        iEmailAddresses = ""
     
        ' Iterate through each EMail Address object of the address book entry
        for each oMailAddress in oEntry.EMailAddresses
          iEmailAddresses = iEmailAddresses & oMailAddress.MailAddress & vbcrlf
        next
     
        msgbox "Address Book entry: " & oEntry.displayname & vbcrlf & iEmailAddresses
      next
     
      set oMailAddress = nothing
      set oEntry = nothing
      set oBook = nothing
    

    This code uses native access to the Address books collection, as opposed to the wrapped collection. You need to pass it a book name.

    I’ll post something regarding question (1) shortly.

    I hope this helps.

    Advansys Support

    #7249
    Support 1a
    Participant

    Regarding question (1), once you have acquired an instance of the wrapped Address book object, (i.e. the gwBook from ‘For Each gwBook in gwBooks’), you need to access the native Object API address book object. You can do this via the .Object property). Once you have access to the native Object API address book property you can access the AddressBookRights property. This is a native Object API property documented by Novell. See: http://developer.novell.com/ndk/doc/gwobjapi/index.html?gwobjenu/data/h7ikbsqg.html

    I hope this helps.

    Advansys Support

    #7245
    RPP
    Participant

    Thanks for your answers – it was finding the ‘unwrapped’ object that was the key.

    I can now alter the multiple email addresses, however I am still having problems with determining the rights.

    Using gwBook.Object.AddressBookRights.Item(1).Access gets me the error below …

    Formativ Applet runtime error
    C:Documents and SettingsGRAHAMMy DocumentsAdvansysFormativApplets_toolbar multi.vbf
    Object required: ‘gwBook.object.addressbookrights’ at line 14, column 4

    I also tried going for the unwrapped object, e.g. Set gwBook = Groupwise.Account.AddressBooks.Item(“Frequent Contacts”), but I get the same error.

    I get similar errors from equivalent code in VB.

    In all cases, its like the AddressBookRights collection has not been substantiated but I don’t understand why.

    I realise this is a Groupwise issue rather than a Formativ one but I am hoping you guys have worked with the AddressBookRights object before and may know how to get it to co-operate.

    Meantime I’ll go explore Novell’s unhelpful site to see what I can find there.

    Thanks – I am so close to completing this that it would be a shame to have to go back to my slow VB approach.

    #7247
    Support 1a
    Participant

    This error means the Object API hasn’t returned an object to you. In this case, the Object API doesn’t return an AddressBookRights collection unless the address book has actually been shared with someone. You need to check if the AddressBookRights object is ‘nothing’ before accessing it.

    Here’s some example code:

    dim oBook
    dim oRights
     
    set oBook = groupwise.account.addressbooks.item("Test")
     
    msgbox oBook.Name
     
    set oRights = nothing
    set oRights = oBook.AddressBookRights
     
    if oRights is nothing then
      msgbox "No object"
    else
      msgbox "object"
    end if
    
    set oRights = nothing
    set oBook = nothing

    I suspect the same issue may be behind the missing address book problem you encountered. If the book has been deleted (or is otherwise unavaible), the Object API will return an empty object. You need to check this before attempting to access the returned objects properties.

    I hope this helps.

    Advansys Support

    #7248
    RPP
    Participant

    OK. I was assuming the ‘rights’ were those that I have over the address book rather than those granted to others. The object being nothing if I haven’t shared it makes sense I guess.

    In which case how can I test if the current user (i.e. the one Formativ is running against) has write rights over an addressbook within the addressbooks collection?

    I realise I can just try and update which will then fail but I not particularly keen on that sort of approach.

    Thanks

    Simon

    #7246
    Support 1a
    Participant

    I couldn’t be sure without trying. I would expect you may be able to read the addressbookrights collection to see if the current user is included in the collection. It may well be that you just have to try to write to a field and see if it allowed.

    As this an Object API issue, you may wish to consult Novell’s online documentation at:

    http://developer.novell.com/ndk/doc/gwobjapi/index.html?gwobjenu/data/h7ikbsqg.html

    Regards,

    Advansys Support

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