コード例 #1
0
 public static SiteModelNode DeployModel()
 {
     return(SPMeta2Model.NewSiteModel(site =>
     {
         site
         .AddField(ArtFields.SpfWebUrl())
         .AddContentType(ArtContentTypes.CustomAutoTitleCT(), contentType =>
         {
             contentType
             .AddContentTypeFieldLink(ArtFields.SpfWebUrl())
             ;
         })
         .AddRootWeb(new RootWebDefinition(), RootWeb =>
         {
             RootWeb
             .AddList(ArtLists.CustomAutoTitleList(), SpfList =>
             {
                 SpfList
                 .AddContentTypeLink(ArtContentTypes.CustomAutoTitleCT())
                 .AddUniqueContentTypeOrder(new UniqueContentTypeOrderDefinition
                 {
                     ContentTypes = new List <ContentTypeLinkValue>
                     {
                         new ContentTypeLinkValue {
                             ContentTypeName = ArtContentTypes.CustomAutoTitleCT().Name
                         }
                     }
                 })
                 .AddListView(ArtViews.SettingsView());
             })
             .AddHostList(BuiltInListDefinitions.Catalogs.MasterPage, list =>
             {
                 var FolderPath = Path.Combine(ArtConsts.SystemPath, ArtConsts.Assets);
                 if (Directory.Exists(FolderPath))
                 {
                     Extentions.FillApplytoFile();
                     ModuleFileUtils.LoadModuleFilesFromLocalFolder(list, FolderPath);
                 }
             })
             ;
         })
         .AddUserCustomAction(ArtActions.ListSettings())
         .AddUserCustomAction(ArtActions.FolderSettings())
         ;
     }));
 }
コード例 #2
0
        public static void Retract(SPDeployOptions options)
        {
            SharePoint.Session(options.url, options.Credentials, Ctx =>
            {
                var Site          = Ctx.Site;
                var CustomActions = Site.UserCustomActions;
                Ctx.Load(CustomActions);
                Ctx.ExecuteQuery();
                var ListSettingsAction = CustomActions.Where(x => x.Name == ArtActions.ListSettings().Name).FirstOrDefault();
                if (ListSettingsAction != null)
                {
                    ListSettingsAction.DeleteObject();
                    Ctx.ExecuteQuery();
                }

                var FolderSettingsAction = CustomActions.Where(x => x.Name == ArtActions.FolderSettings().Name).FirstOrDefault();
                if (FolderSettingsAction != null)
                {
                    FolderSettingsAction.DeleteObject();
                    Ctx.ExecuteQuery();
                }
            });
        }