Leading announcement: I appreciate the feedback I’ve gotten from some of you about the API of the new client. One piece of key feedback I want very much to incorporate is how we can unify accessing single-valued and multi-valued attributes. Please send any additional comments my way.
For this week’s post we see the benefits of promoted properties and transactions. The full source code is available on MSDN code gallery.
Example 1: Create a Named Group
In this example we create a new object and pass it to the client to be created on the server.
Now let’s add some users to the group.
Example 2: Add members to Group
In this example we demonstrate using a transaction to track our changes to the group object. To add a member to a group simply add another reference to the ExplicitMember attribute. The public client exposes the ExplicitMember as List<Guid>, and in this example we add another Guid. Once all of the changes are complete, we accept the changes and send the transaction to the client. The client transforms the changes into da:ModifyRequest/da:Change elements and sends them over the wire.
public void AddUsers(Guid groupId)
We successfully created a group and added users to it programmatically.