コード例 #1
0
        public CustomActionCreator CreateAppWorkflowAssociationCustomAction(ClientContext ctx, Web web,
                                                                            Dictionary <string, ClassicWorkflowCreator> classicWorkflows, string userCustomActionTitle)
        {
            OnNotify(ProvisioningNotificationLevels.Normal, "Creating workflow registration bullet custom action");
            var creator = new CustomActionCreator
            {
                Location         = "ScriptLink",
                Sequence         = 9999,
                Title            = userCustomActionTitle,
                RegistrationType = UserCustomActionRegistrationType.None
            };

            var js = new JavaScriptSerializer();
            var classicWorkflowsJson = js.Serialize(classicWorkflows);

            var customActionTemplate =
                Utility.GetFile("IQAppProvisioningBaseClasses.Resources.AppWorkflowAssociationCustomAction.min.js",
                                Assembly.GetExecutingAssembly());

            creator.ScriptBlock =
                customActionTemplate.Replace("{@WorkflowCreatorsJSON}", classicWorkflowsJson)
                .Replace("{@WebUrl}", web.Url)
                .Replace("{@WebServerRelativeUrl}", web.ServerRelativeUrl)
                .Replace("{@UserCustomActionTitle}", userCustomActionTitle);

            return(creator);
        }
コード例 #2
0
        public CustomActionCreator CreateNavigationUserCustomAction(NavigationCreator navigation)
        {
            OnNotify(ProvisioningNotificationLevels.Verbose, "Creating navigation custom action for app web");
            var creator = new CustomActionCreator
            {
                Location         = "ScriptLink",
                Sequence         = 9999,
                Title            = "IQAppWebNavigation",
                RegistrationType = UserCustomActionRegistrationType.None
            };

            var js      = new JavaScriptSerializer();
            var navJson = js.Serialize(navigation);

            var customActionTemplate =
                Utility.GetFile("IQAppProvisioningBaseClasses.Resources.AppWebNavigationCustomAction.min.js",
                                Assembly.GetExecutingAssembly());

            creator.ScriptBlock =
                customActionTemplate.Replace("{@NavigationJSON}", navJson)
                .Replace("{@WebServerRelativeUrl}", _web.ServerRelativeUrl);

            return(creator);
        }