Hello,
using the solidworks PDM API, my goal is to have a method that will return true or false as to whether a specific user is a member of a group.
my code wasn't working as expected, so I went into the PDM admin tool to check the current memberships of the specific user in question.
What I have noticed is that if I add a user into a group using the admin tool (box has green checkmark in it), and then remove the checkmark, the end result is that the code below continues to indicate TRUE that the user is a member of the group (even though the check box doesn't have the check mark in it)
however, using the admin tool if I "delete" the item where the user is listed with an unchecked box...the end result is that the code below then works as desired.
bottom line, it seems like the API continues to consider a user to be a member of a group even if the check box is not checked! If you delete the entry completely, then at that point the API will function as expected (that the user is no longer a member)
have others seen this behavior? if so, why does the API continue to indicate that a user is a member of a group if the check box is no longer checked?
Public Function userIsDocControlMember2(poCmd As EdmLib.EdmCmd) As Boolean
'Declare an IEdmUserMgr5 object
Dim UserMgr As IEdmUserMgr5
UserMgr = poCmd.mpoVault 'The IEdmUserMgr5 interface is implemented by the same class as the IEdmVault5 interface
Dim docControlIedmUserGroup As IEdmUserGroup5 = UserMgr.GetUserGroup("Doc Control")
Dim Users As String = vbNullString
Dim UserPos As IEdmPos5
UserPos = docControlIedmUserGroup.GetFirstUserPosition()
While Not UserPos.IsNull
Dim User As IEdmUser5
User = docControlIedmUserGroup.GetNextUser(UserPos)
'is this member the current user?
If User.ID = currentIedmuser.ID Then
Return True
End If
End While
Return False
End Function
SolidworksSolidworks Pdm enterprise Pdm