private string GetGroupCreator(ClientContext ctx, string title, AppManifestBase manifest)
        {
            OnVerboseNotify("Getting group definition for " + title);

            var builder = new GroupCreatorBuilder();

            builder.VerboseNotify += builder_Notify;
            if (manifest == null)
            {
                return(builder.GetGroupCreator(ctx, title));
            }
            builder.GetGroupCreator(ctx, title, manifest);
            return(string.Empty);
        }
Пример #2
0
        /// <summary>
        ///     Reads the differences in groups ignoring the associated owner, etc. groups
        /// </summary>
        /// <param name="webDefinition"></param>
        private void GetGroupDifferences(WebCreator webDefinition)
        {
            OnVerboseNotify("Processing Groups");
            _sourceContext.Web.EnsureProperties(w => w.SiteGroups, w => w.AssociatedMemberGroup,
                                                w => w.AssociatedOwnerGroup, w => w.AssociatedVisitorGroup);
            _baseContext.Web.EnsureProperties(w => w.SiteGroups);
            var groupCreatorBuilder = new GroupCreatorBuilder();

            groupCreatorBuilder.VerboseNotify += (sender, args) => OnVerboseNotify(args.Message);

            var groupsToAdd =
                _sourceContext.Web.SiteGroups.Where(
                    g => _baseContext.Web.SiteGroups.FirstOrDefault(bg => bg.Title == g.Title) == null &&
                    g.Id != _sourceContext.Web.AssociatedMemberGroup.Id &&
                    g.Id != _sourceContext.Web.AssociatedOwnerGroup.Id &&
                    g.Id != _sourceContext.Web.AssociatedVisitorGroup.Id);

            foreach (var group in groupsToAdd)
            {
                groupCreatorBuilder.GetGroupCreator(_sourceContext, group.Title, webDefinition.AppManifest);
            }
        }