Add user to StoreGroup

Apr 14, 2009 at 6:10 PM
How do I add a user (C# or VB.NET) to a stroreGroup?

Will the CretateStoreGoupMember accomplish this task? If, so why does this method take a boolean (IsMember)?
<title>SqlAzManStoreGroup.CreateStoreGroupMember Method</title> <xml></xml> <link rel="stylesheet" type="text/css" href="MSDN.css" />

SqlAzManStoreGroup.CreateStoreGroupMember Method 

Creates the store group member.

public IAzManStoreGroupMember CreateStoreGroupMember(
   IAzManSid sid,
   WhereDefined whereDefined,
   Boolean isMember
);

Thanks!

Craig


Apr 14, 2009 at 8:54 PM
I got it...it was the right method I was just sending in the wrong vars.

Dim azManDb As New NetSqlAzMan.SqlAzManStorage("Connection string goes here")

Dim myStore As NetSqlAzMan.Interfaces.IAzManStore = azManDb.GetStore("Store Name goes herel")

'Get the correct storegroup to add the user to.
Dim imyStoregroup As IAzManStoreGroup = myStore.GetStoreGroup(storegroup.ToString())

'Get my azmanID --- MY method to get the SID from my UserDefined user table.
Dim myID As NetSqlAzMan.Interfaces.IAzManSid = GetUserSIDfromDB(user)

Dim storegroupMember As IAzManStoreGroupMember = imyStoregroup.CreateStoreGroupMember(myID, WhereDefined.Database, True)

worked = storegroupMember.IsMember

Apr 14, 2009 at 10:06 PM
Hi Craig,
as you can see from the Store / Application Group properties dialog, you can add Users and Groups as 'Members' or as 'Non-Members' that means: final result = { Members } - {Non Members}
Non membership could be useful when you have to add a Windows Group (made of 100 users) execpt 1 user; add the Group as a 'Member' and the 1 user as a 'Non-Member'.
Regards,
Andrea.

Apr 14, 2009 at 10:06 PM
Great.