示例#1
0
        private async void btnCreateGroup_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            GroupDTO group = null;

            //Create group
            try
            {
                group = await groupsApi.CreateGroupAsync(new CreateGroupDTO()
                {
                    AllowEmployeeAcknowledgeable = ucGroupSettings.IsAcknowledgeableSelected(),
                    AllowEmployeeBookmark        = ucGroupSettings.IsBookmarkSelected(),
                    AllowEmployeeSticky          = ucGroupSettings.IsStickySelected(),
                    GroupName = ucGroupSettings.GetGroupName()
                });
            }
            catch (HttpOperationException er)
            {
                new ErrorDialog(er.Response.ReasonPhrase, er.Response.Content).ShowDialog();
                return;
            }

            //Add users, roles, and channels
            List <string> channelNames = ucGroupSettings.GetChannels().Select(c => c.Name).ToList();

            try
            {
                await groupsApi.AddUsersToGroupAsync(group.Id, ucGroupSettings.GetSelectedUsers());

                await groupsApi.AddRolesToGroupAsync(group.Id, ucGroupSettings.GetSelectedRoles());

                foreach (string channelName in channelNames)
                {
                    await channelsApi.CreateChannelAsync(group.Id, channelName);
                }
            }
            catch (HttpOperationException er)
            {
                new ErrorDialog(er.Response.ReasonPhrase, er.Response.Content).ShowDialog();
                return;
            }

            MessageBox.Show("The group has now been created!");
            GroupCreated?.Invoke(group);
        }
 /// <summary>
 /// Create new group
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='requestParameters'>
 /// Create group request parameters
 /// </param>
 public static Group CreateGroup(this IGroups operations, GroupCreationRequest requestParameters)
 {
     return(operations.CreateGroupAsync(requestParameters).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Creates new workspace.
 /// </summary>
 /// <remarks>
 /// &lt;br/&gt;**Required scope**: Workspace.ReadWrite.All&lt;br/&gt;To set the
 /// permissions scope, see [Register an
 /// app](https://docs.microsoft.com/power-bi/developer/register-app).
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='requestParameters'>
 /// Create group request parameters
 /// </param>
 /// <param name='workspaceV2'>
 /// Preview feature: Create a workspace V2. The only supported value is true.
 /// </param>
 public static Group CreateGroup(this IGroups operations, GroupCreationRequest requestParameters, bool?workspaceV2 = default(bool?))
 {
     return(operations.CreateGroupAsync(requestParameters, workspaceV2).GetAwaiter().GetResult());
 }
示例#4
0
 /// <summary>
 /// Create a new group
 /// </summary>
 /// <remarks>
 /// Creates a new group with the caller as the group administrator. The caller
 /// is also initially a member of the group.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='createGroupDTO'>
 /// The initial settings of the group regarding group name and member rights
 /// </param>
 public static GroupDTO CreateGroup(this IGroups operations, CreateGroupDTO createGroupDTO = default(CreateGroupDTO))
 {
     return(operations.CreateGroupAsync(createGroupDTO).GetAwaiter().GetResult());
 }