Not able to delete ApplicationGroupMember programatically

Apr 14, 2010 at 6:16 PM

We can create an applicationGroupMember using the following code: (and that works fine)

azManApplicationGroup.CreateApplicationGroupMember(groupAzManSid, WhereDefined.Application, true);
<font size="2">



But, not able to DELETE the applicationGroupMember. I am using the following code...


/// The below code (ContainsKey) does not work for some reason -- hence looping through as below
     //if (groupMembersDictionary.ContainsKey(groupAzManSid))
         //    azManApplicationGroup.Members.Remove(groupAzManSid);
		Dictionary groupMembersDictionary = azManApplicationGroup.Members;
                    foreach (IAzManSid azManSid in groupMembersDictionary.Keys)
                        if (azManSid.StringValue == groupAzManSid.StringValue) /// THIS WORKS--But,This does not work --> if (groupMembersDictionary.ContainsKey(groupAzManSid))
                            azManApplicationGroup.Members.Remove(azManSid);   //// THIS does NOT WORK
Apr 14, 2010 at 7:33 PM


you are using the wrong method.

Remove() is useful only to remove member from Members collection but does write anything on the Storage (same behavior of DataSet.Tables.Remove()).

The right method is SqlAzManApplicationGroupMember/SqlAzManStoreGroupMemer.Delete()



Andrea Ferendeles
NetSqlAzMan Project Coordinator
E-mail Web