GroupFactoryNewGroup Method |
Namespace: AskiaPortalCmn
Create a new group and save it
var context = ContextFactory.CreateByUserGuid(Guid.Parse("20BE5F84-F006-49A0-9674-4B16A090AF2D")); var contextValidation = context.Validate(); if (!contextValidation.Success) { throw contextValidation.Exception; } var group = GroupFactory.NewGroup(context); if (group == null) { Console.Error.WriteLine("Could not create a new group"); return; } group.Name = "My new group"; var saveResult = group.Save(); if (saveResult.Success) { Console.WriteLine("The group `{0}` (Id={1}) was successfully saved", group.Name, group.Id); } else { Console.Error.WriteLine("Unable to save the group"); Console.Error.Write(saveResult.Exception.Message); }