/ Forums / Advansys Formativ / Creating Solutions with Formativ / programmatically activate an account

  • Creator
    Topic
  • #4279
    jcromwijk
    Participant

      Hi,

      I want to activate programmatically an account from which I know the name.
      This is needed for programmatically switching between a main account and a proxied account and back to the main account.

      Do you know how?

      Greetings,
      Jan Cromwijk

    • Author
      Replies
    • #7702
      Support 3
      Participant

        You can use GroupWise.Proxy(UserID, aWindow) method to proxy to an account. See the Formativ Language Guide for more information.

          
        call GroupWise.Proxy("Test", prwCurrentWindow)
        

        Once you proxy to an account, you can check “Client.clientstate.currentaccount.proxied ” property prior to proxying back to the main account.

        Hope this helps.

        Regards,
        Advansys Support

        [This message was edited by Support 2 on August 17, 2006 at 11:41 PM.]

        #7706
        jcromwijk
        Participant

          Thanks, the code to proxy to an account works good.
          But, it does not work to switch to the main account (thats normally not proxied).

          Greetings,
          Jan C

          #7698
          Support 3
          Participant

            You can use the GroupWise.Proxy() method to proxy to an account and back to the main account. The sample code below will proxy to an account and proxy back to the main account:

              
              if Client.clientstate.currentaccount.proxied then
                call GroupWise.Proxy("MainAccountUserID", prwCurrentWindow)
              else
                call GroupWise.Proxy("ProxyAccountUserID", prwCurrentWindow)
              end if
            

            If we have misunderstood your question, please let us know.

            Regards,
            Advansys Support

            #7708
            jcromwijk
            Participant

              Hi, you understood my question correct.
              Only my issue is a little bit more complicated.

              I have 2 GW mainwindows open
              1. the mainaccount mailbox (Jan Cromwijk)
              2. a proxied mailbox (test)

              This are the steps I am walking:
              – I am creating an e-mail in the mainaccount mailbox window
              – when creating it I am switching to the window with the proxied mailbox
              (Client.clientstate.currentaccount.proxied = true)
              – Then I go directly back to my message without activating the mainaccount window
              (Client.clientstate.currentaccount.proxied STAYS true)
              – After finishing the message I sent it.
              On the ‘before send event’ a small applet gets the accountname related to the message
              sAccountName = GroupWise.ItemGetText(“X00”, itfFrom)
              Utilities.TransferData = sAccountName
              – The applet I wrote to sort send e-mails to the right projectfolder starts on ‘the after send’ event.
              – It looks if the account is proxied and sees it is proxied so it goes looking in the proxied account for the folder to sort to.
              BUT
              The message is created in the main account, thus it must get the folders in the mainaccount.

              To fix this issue I read out the Utilities.TransferData to a sAccountName
              Then I want to check to following:
              – is the current accountname the same as the accountname in the variable
              – if it is different then activate the correct mailbox to get the correct folderlist.

              When I use the code you suggest then switching to the proxied account (test) works fine. But when switching to the mainaccount I got a message that I have no rights to proxy to that account.
              Another not wished effect is that the currently active window gets the proxied account so when switching to the proxied the window with the mainaccount is switched to the proxied so I have two windows with the proxied account.

              I hope you understand the issue and can help me to solve this adventure.

              Greetings,
              Jan Cromwijk

              #7704
              Support 3
              Participant

                quote:


                When I use the code you suggest then switching to the proxied account (test) works fine. But when switching to the mainaccount I got a message that I have no rights to proxy to that account.


                Make sure the “Test” account has appropriate access rights to proxy back to “Main” account. In “Main” account, select “Tools – Options – Security – Proxy Access” to see the access rights.

                Regards,
                Advansys Support

                #7703
                jcromwijk
                Participant

                  Thanks for your suggestion.

                  It works, but it is not exactly the solution I am looking for. Because:
                  – when making a proxy account of the main account is disabeling the advantage I make of using the quick messages collection for quickly finding the last sent item.
                  – the current active groupwise window gets the proxied account so when switching to the proxied account I got two groupwise windows with the same account.

                  I wish I could say to my program, for this message you must use this account and for another message you must use that account.

                  Greetings,
                  Jan Cromwijk

                  #7707
                  Support 3
                  Participant

                    quote:


                    Originally posted by Support 3:
                    Unfortunately you can not use the quick messages collection on a proxied account. See the Object API note about the GetQuickMessagesCollection method:

                    quote:


                    http://developer.novell.com/documentation/gwobjapi/index.html?gwobjenu/data/h7ikbsqg.html
                    QuickMessages GetQuickMessagesCollection(Date StartDate, QuickMessagesCreationConstants eHowBuildList)

                    The QuickMessages collection should return message items quicker than other ways (such as the AllMessages collection or querying objects with their message lists). It is very fast when returning new messages, but retrieving modified messages is somewhat slower. The slowest is to retrieve all messages from an account.

                    GetQuickMessagesCollection should be called only on a main account. Calling this method from a Proxy account results in an error.

                    Messages in a folder that have been shared do not appear in the resulting QuickMessages collection. These folders are not part of the user’s database and are outside of the account.

                    Folder contains a similar method. However, the Account object method uses every message in the account, while the Folder object method looks through message items that are in the specified folder.

                    NOTE:This method does not return hidden messages. For GroupWise 6.5, SP3 and later versions, call the GetQuickMessagesCollectionExt method to return hidden messages.

                    This method is available only in GroupWise 6.5, SP 2 and later versions.


                    Seems like you have to use the Allmessages method on a proxied account and GetQuickMessagesCollection method on the main login account. See the sample code below. You can modify the filter expression to specify date, message type, etc.

                      
                      if Client.clientstate.currentaccount.proxied then
                        set oMessages = Client.clientstate.currentaccount.Allmessages.Find("(NOTE)")
                        msgbox oMessages.count
                      else
                        set oMessages = groupwise.account.GetQuickMessagesCollection(date, 1)
                        msgbox oMessages.count
                      end if
                    

                    Hope this helps.

                    Regards,
                    Advansys Support


                    #7700
                    jcromwijk
                    Participant

                      Thanks for your answer.
                      Unfortunately I know this already.

                      The thing I do not know at this moment is:
                      How can I get the sent-items of an account when that account is not active in the current GroupWise window?(without switching visibly to that account). the account can be a mainaccount or a proxied.

                      Greetings,
                      Jan Cromwijk

                      #7701
                      Support 3
                      Participant

                        You can use the Proxy, MultiLogin or Login method in the Application object. These methods will access the account object when that account is not active in the GroupWise window. Login and MultiLogin method requires a user ID and password of the account. The MultiLogin method requires only a UserID with a Trusted Application (GroupWise 5.5 and later versions). Assuming the account has the proxy rights then you can use the Proxy() method to access the account object.

                          
                        set oAccount = GroupWise.account.parent.proxy("test")
                        msgbox oAccount.owner.displayname
                        

                        Hope this helps.

                        Regards,
                        Advansys Support

                        #7699
                        jcromwijk
                        Participant

                          Thanks for the answer.

                          I will try it with the login or multilogin method.

                          Greetings,
                          Jan C

                          #7705
                          Support 3
                          Participant

                            Thanks for your feedback. If you have any further questions, please do not hesitate to contact us. Alternatively, you can post GroupWise Object API related questions into the following forum:
                            http://groups.google.com.au/group/novell.devsup.gwobjapi?hl=en

                            Regards,
                            Advansys Support

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