当前位置: 首页>>代码示例>>C#>>正文


C# SPWeb.Update方法代码示例

本文整理汇总了C#中SPWeb.Update方法的典型用法代码示例。如果您正苦于以下问题:C# SPWeb.Update方法的具体用法?C# SPWeb.Update怎么用?C# SPWeb.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SPWeb的用法示例。


在下文中一共展示了SPWeb.Update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: create_group

        protected SPGroup create_group(string group_name, SPWeb web)
        {
            SPUser user = web.EnsureUser("Administrator");
            web.SiteGroups.Add(group_name, user, null, group_name);
            SPGroup group = web.SiteGroups[group_name];
            web.Update();

            SPRoleAssignment assignment = new SPRoleAssignment(group);
            SPRoleDefinition role = web.RoleDefinitions["读取"];
            assignment.RoleDefinitionBindings.Add(role);
            web.RoleAssignments.Add(assignment);

            return group;
        }
开发者ID:ricardocarneiro,项目名称:SharePoint-1,代码行数:14,代码来源:Groups.EventReceiver.cs

示例2: WriteToLog

        internal static void WriteToLog(SPWeb web, string message)
        {
            ASCIIEncoding enc = new ASCIIEncoding();
            UnicodeEncoding uniEncoding = new UnicodeEncoding();

            string errors = message;

            SPFile files = web.GetFile("/" + DocumentLibraryName + "/" + LogFileName);

            if (files.Exists)
            {
                byte[] fileContents = files.OpenBinary();
                string newContents = enc.GetString(fileContents) + Environment.NewLine + errors;
                files.SaveBinary(enc.GetBytes(newContents));
            }
            else
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    using (StreamWriter sw = new StreamWriter(ms, uniEncoding))
                    {
                        sw.Write(errors);
                    }

                    SPFolder LogLibraryFolder = web.Folders[DocumentLibraryName];
                    LogLibraryFolder.Files.Add(LogFileName, ms.ToArray(), false);
                }
            }

            web.Update();
        }
开发者ID:JoJo777,项目名称:TTK.SP,代码行数:31,代码来源:Logging.cs

示例3: DeployRegionalSettings

        private void DeployRegionalSettings(object modelHost, SPWeb web, RegionalSettingsDefinition definition)
        {
            var settings = GetCurrentRegionalSettings(web);

            InvokeOnModelEvent(this, new ModelEventArgs
            {
                CurrentModelNode = null,
                Model = null,
                EventType = ModelEventType.OnProvisioning,
                Object = settings,
                ObjectType = typeof(SPRegionalSettings),
                ObjectDefinition = definition,
                ModelHost = modelHost
            });

            MapRegionalSettings(settings, definition);

            web.RegionalSettings = settings;
            web.Update();

            InvokeOnModelEvent(this, new ModelEventArgs
            {
                CurrentModelNode = null,
                Model = null,
                EventType = ModelEventType.OnProvisioned,
                Object = settings,
                ObjectType = typeof(SPRegionalSettings),
                ObjectDefinition = definition,
                ModelHost = modelHost
            });
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:31,代码来源:RegionalSettingsModelHandler.cs

示例4: DeployDefinition

        private void DeployDefinition(object modelHost, SPWeb web, SearchSettingsDefinition definition)
        {
            InvokeOnModelEvent(this, new ModelEventArgs
            {
                CurrentModelNode = null,
                Model = null,
                EventType = ModelEventType.OnProvisioning,
                Object = web,
                ObjectType = typeof(SPWeb),
                ObjectDefinition = definition,
                ModelHost = modelHost
            });

            ProcessObject(web, definition);

            InvokeOnModelEvent(this, new ModelEventArgs
            {
                CurrentModelNode = null,
                Model = null,
                EventType = ModelEventType.OnProvisioned,
                Object = web,
                ObjectType = typeof(SPWeb),
                ObjectDefinition = definition,
                ModelHost = modelHost
            });

            web.Update();
        }
开发者ID:Uolifry,项目名称:spmeta2,代码行数:28,代码来源:SearchSettingsModelHandler.cs

示例5: InitializeWebDefaultRegionalSettings

 public void InitializeWebDefaultRegionalSettings(SPWeb web)
 {
     // Web regional settings should en-CA or fr-CA, depending on web default language
     var settings = web.Language == (uint)Language.English.Culture.LCID ? this.EnglishCanadianSettings(web, false) : this.FrenchCanadianSettings(web, false);
     web.RegionalSettings = settings;
     web.Update();
 }
开发者ID:GAlexandreBastien,项目名称:Dynamite-2010,代码行数:7,代码来源:RegionalSettingsHelper.cs

示例6: UpdateTask

 /// <summary>
 /// This method update task ref in the root site.
 /// </summary>
 /// <param name="TaskId">string</param>
 /// <param name="IsComplete">bool</param>
 public void UpdateTask(int TaskId, string Status, SPWeb Web)
 {
     SPList ObjTaskList = Web.Lists["Document Approval Tasks"];
     SPListItem _task = ObjTaskList.Items.GetItemById(TaskId);
     _task["Status"] = Status;
     _task.SystemUpdate();
     Web.Update();
 }
开发者ID:infinitimods,项目名称:clif-sharepoint,代码行数:13,代码来源:DocumentApprovalTasks.cs

示例7: CreateNewList

 internal static void CreateNewList(SPWeb web, string name, string desc, SPListTemplateType type)
 {
     if (web.Lists.TryGetList(name) == null)
     {
         web.Lists.Add(name, desc, type);
         web.Update();
     }
 }
开发者ID:jimblanchard,项目名称:PnP,代码行数:8,代码来源:SiteManager.cs

示例8: AddTemplateList

 public static void AddTemplateList(SPWeb spWeb, String templateName, String templateFilePath, String listName, String listDescription)
 {
     // Adding Configuration List Template
     SPList templateList = spWeb.Site.RootWeb.Lists["List Template Gallery"];
     // Uploading Configuration List Template to the Root web
     bool f = (from SPFile file in templateList.RootFolder.Files let fileName = Path.GetFileName(templateFilePath) where fileName != null && (file.Name.ToLower() == templateName.ToLower() || fileName.ToLower() == file.Name.ToLower()) select file).Any();
     if (f == false)
     {
         if (File.Exists(templateFilePath))
         {
             byte[] b = File.ReadAllBytes(templateFilePath);
             templateList.RootFolder.Files.Add(Path.GetFileName(templateFilePath), b);
             templateList.Update();
             spWeb.Update();
         }
     }
     // Creating Configuration List to Web
     SPListTemplate listTemplate = spWeb.Site.GetCustomListTemplates(spWeb.Site.RootWeb)[templateName];
     SPList slist;
     try
     {
         slist = spWeb.Lists[listName];
     }
     catch (Exception)
     {
         slist = null;
     }
     if (slist == null)
     {
         spWeb.Lists.Add(listName, listDescription, listTemplate);
         spWeb.Update();
     }
     int index = 0;
     foreach (SPListItem item in templateList.Items)
     {
         if (listName != null)
             if (item.DisplayName.ToLower() == listName.ToLower())
             {
                 templateList.Items.Delete(index);
                 templateList.Update();
                 break;
             }
         index += 1;
     }
 }
开发者ID:Santhoshonet,项目名称:SP2010Library,代码行数:45,代码来源:Templates.cs

示例9: AddEventReceivers

 private static void AddEventReceivers(SPWeb web)
 {
     var documentContentType = web.ContentTypes[new SPContentTypeId("0x01")];
     AddEventReceiver(documentContentType, SPEventReceiverType.ItemAdded, typeof(FileChangedEventReceiver), 1000);
     AddEventReceiver(documentContentType, SPEventReceiverType.ItemUpdated, typeof(FileChangedEventReceiver), 1001);
     AddEventReceiver(documentContentType, SPEventReceiverType.ItemAttachmentAdded, typeof(FileChangedEventReceiver), 1002);
     
     web.Update();
     
     ULSLog.LogMessage("Successfully installed global event receivers on base item content type.");
 }
开发者ID:egil,项目名称:SPADD,代码行数:11,代码来源:FileChangedMonitorFeature.EventReceiver.cs

示例10: TeamSiteWebFeatureActivatedHandler

        internal static void TeamSiteWebFeatureActivatedHandler(SPWeb web, SPFeaturePropertyCollection properties)
        {
            // Create three additional libraries
            CreateNewList(web, "Meeting Notes", "Meeting notes", SPListTemplateType.DocumentLibrary);
            CreateNewList(web, "Presentations", "Presentations", SPListTemplateType.DocumentLibrary);
            CreateNewList(web, "Issues", "Issues", SPListTemplateType.IssueTracking);

            // Set master page
            web.MasterUrl = SPUrlUtility.CombineUrl(web.ServerRelativeUrl, "/_catalogs/masterpage/contoso.master");
            web.Update();
        }
开发者ID:jimblanchard,项目名称:PnP,代码行数:11,代码来源:SiteManager.cs

示例11: AddEventReceiverToWeb

        private void AddEventReceiverToWeb(SPWeb currentWeb, SPEventReceiverType type)
        {
            SPEventReceiverDefinition def = currentWeb.EventReceivers.Add();
            def.Name = "Web Event Receiver - " + type.ToString();
            def.Type = type;
            def.Assembly = Assembly.GetExecutingAssembly().FullName;
            def.Class = eventRcvClass;
            def.Update();

            currentWeb.Update();
        }
开发者ID:vball525,项目名称:EventReceivers,代码行数:11,代码来源:Site.EventReceiver.cs

示例12: EnsureLanguageSupport

        public void EnsureLanguageSupport(SPWeb web, CultureInfo language)
        {
            if (!web.SupportedUICultures.Contains(language))
            {
                if (!web.IsMultilingual)
                {
                    web.IsMultilingual = true;
                }

                web.AddSupportedUICulture(language);
                web.Update();
            }
        }
开发者ID:andresglx,项目名称:Dynamite,代码行数:13,代码来源:MuiHelper.cs

示例13: UpdateMasterPageofWebs

        private void UpdateMasterPageofWebs(SPWeb childWeb)
        {
            childWeb.MasterUrl = MasterUrl;
            childWeb.CustomMasterUrl = CustomMasterUrl;
            childWeb.Update();

            foreach (SPWeb childSubWeb in childWeb.Webs)
            {
                UpdateMasterPageofWebs(childSubWeb);
            }


        }
开发者ID:iohn2000,项目名称:gsa-custom-searchbox.spmaster,代码行数:13,代码来源:Archive.EventReceiver.cs

示例14: DeleteCustomAction

        /// <summary>
        /// Removes a custom action from a web
        /// </summary>
        /// <param name="web">The SharePoint web</param>
        /// <param name="actionName">The ID for the custom action</param>
        public void DeleteCustomAction(SPWeb web, string actionName)
        {
            var customActionId = this.GetCustomActionIdForName(web, actionName);
            if (!string.IsNullOrEmpty(customActionId))
            {
                var customAction = web.UserCustomActions[new Guid(customActionId)];
                customAction.Delete();
            }

            if (!string.IsNullOrEmpty(customActionId))
            {
                web.Update();
            }
        }
开发者ID:GAlexandreBastien,项目名称:Dynamite-2010,代码行数:19,代码来源:CustomActionHelper.cs

示例15: ClearWikiPage

 public void ClearWikiPage(SPFile wikiFile, SPWeb web)
 {
     wikiFile.RequireNotNull("wikiFile");
     web.RequireNotNull("web");
     ChangeWikiContent(wikiFile, string.Empty);
     using (SPLimitedWebPartManager limitedWebPartManager = wikiFile.GetLimitedWebPartManager(PersonalizationScope.Shared))
     {
         List<Microsoft.SharePoint.WebPartPages.WebPart> webParts =
             new List<Microsoft.SharePoint.WebPartPages.WebPart>(
                 from Microsoft.SharePoint.WebPartPages.WebPart w in limitedWebPartManager.WebParts
                 select w);
         webParts.ForEach(w => limitedWebPartManager.DeleteWebPart(w));
     }
     web.Update();
 }
开发者ID:utdcometsoccer,项目名称:MySP2010Utilities,代码行数:15,代码来源:WikiPagesOperations.cs


注:本文中的SPWeb.Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。