private string GetContentTypeCreator(ClientContext ctx, string title, AppManifestBase manifest)
        {
            OnVerboseNotify("Getting content type creator for " + title);

            var builder = new ContentTypeCreatorBuilder();

            builder.VerboseNotify += builder_Notify;
            if (manifest == null)
            {
                return(builder.GetContentTypeCreator(ctx, title));
            }
            builder.GetContentTypeCreator(ctx, title, manifest);
            return(string.Empty);
        }
Ejemplo n.º 2
0
        private void GetContentTypeDifferences(WebCreator webDefinition)
        {
            OnVerboseNotify("Processing Content Types");
            webDefinition.AppManifest.ContentTypeCreators = new Dictionary <string, ContentTypeCreator>();
            _sourceContext.Web.EnsureProperty(w => w.ContentTypes.Include(ct => ct.Name));
            _baseContext.Web.EnsureProperty(w => w.ContentTypes.Include(ct => ct.Name));
            var contentTypeCreatorBuilder = new ContentTypeCreatorBuilder();

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

            var contentTypesToAdd =
                _sourceContext.Web.ContentTypes.Where(
                    ct => _baseContext.Web.ContentTypes.FirstOrDefault(bct => bct.Name == ct.Name) == null);

            foreach (var contentType in contentTypesToAdd)
            {
                contentTypeCreatorBuilder.GetContentTypeCreator(_sourceContext, contentType.Name,
                                                                webDefinition.AppManifest);
            }
        }