5 Replies Latest reply on Mar 17, 2011 3:43 PM by Tim Webb

    EPDM API Add-in to get email addresses for users in group

    Tim Webb

      Our company is collaborating with several outside team players who do not have EPDM but need to know when files have changed through the ECO process because the changes could affect the portion of the effort they are responsible for. So there is a need to email the ECO document to several people in a group. These people are on our domain so I have emails for them in a PDM group in the vault.

       

      I am able to gather the group members and their names but need code to also extract their email address stored in the vault using this code:

      Private Sub ListGroupMembers(ByVal vault As EdmVault5, ByVal groupName As String)

       

      'The following code shows a message box with the names of all users who are members of a group with a certain name:

       

      On Error GoTo ErrHand

       

      Dim userMgr As IEdmUserMgr5

      userMgr = vault

       

      Dim group As IEdmUserGroup5

      group = userMgr.GetUserGroup(groupName)

       

      If group Is Nothing Then

      MsgBox(

      "There is no group named " + groupName + ".")

       

      Exit Sub

       

      End If

       

      Dim pos As IEdmPos5

      pos = group.GetFirstUserPosition

       

      Dim message As String

      message =

      "The following users are member of group " + groupName + ":" + vbLf

       

      While Not pos.IsNull

       

      Dim user As IEdmUser5

      user = group.GetNextUser(pos)

      message = message + user.Name + vbLf

       

      ' Send email code needs to go here! :)

       

      End While

      MsgBox(message)

       

      Exit Sub

       

      ErrHand:

      HandleError(Err.Number)

       

      End Sub

       

      <<I have had a difficult time finding more example code blocks through the help. Are there any more resources on the web or in the installation?>>

       

      Thanks in advance.

        • Re: EPDM API Add-in to get email addresses for users in group
          Michael Dekoning

          Tim,

           

          The IEdmUser interface does not have a property for email.

           

          You could set up a Transition Action in the workflow to send an email to a group containing the "outside" users.

           

          Hope this helps,

           

          Mike

          EPDM 2010 SP2

          • Re: EPDM API Add-in to get email addresses for users in group
            You can use the vault's built-in SendMsg methods from IEdmUser or IEdmUserGroup if you're using SMTP.
            • Re: EPDM API Add-in to get email addresses for users in group
              Tim Webb

              Guys, I *really* appreciate the input and I do know how to do each of these however I didn't clarify the part about needing to email the actual document to the group members as an attachment. (Edit: I haven't found a way to send an attachment with the email using SendMsg)

               

              If it weren't for this part, I would have all bases covered. And yes, I know that totally subverts the meaning of a "document control" vault. That's not my problem, this just has to happen. I have made all the arguments and we are part of such a large group of players, there's not much choice. If I can't get this to work, there will be problems.

               

              I either need to email the document to the group members as an attachment (easiest option in my mind) or need to find more options...like export the group member names to an external list and do an LDAP query to match up email addresses, or catenate the first & last names together and append the @domain, or etc. But the ECO document must be emailed to the external teams who do NOT have EPDM and training them is not an option.

               

              I really appreciate you guys welcoming the new guy here.

              Tim

                • Re: EPDM API Add-in to get email addresses for users in group

                  Sorry Tim, I missed that you need to send an attachment and that certainly makes things more difficult. Sounds like you'll either need to do your LDAP query or query the database for the email addresses. (LDAP pwould be better for security reasons.) You could always write a quick web service that could do it all for you...

                   

                  I wouldn't trust  concatenating the first and last names.

                   

                  The only other option I can think of is putting the email address into the User data property of the user, but that's an awful workaround.

                   

                  A lot of extra work for a missing property. Sigh. (Don't forget the enhancement request!)

                  • Re: EPDM API Add-in to get email addresses for users in group
                    Tim Webb

                    Just thought I'd close the loop on this discussion. I did the LDAP query against each member of the group I need to send the email to and grab their email address.

                     

                    Then I get the latest version of the document I want to send as an email and add it as an attachment. It works spectacularly, in fact the production manager has requested several other non-sensitive documents be broadcast to the entire company after changes are complete.

                     

                    Thanks for the input.

                     

                    Tim