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


C# SPListItem.Update方法代码示例

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


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

示例1: OnExpiration

        public override void OnExpiration(SPListItem item, XmlNode parametersData, DateTime expiredDate)
        {
           item["Status"] = "Expired";
		   item["ExpiredDate"] = expiredDate;
		   
		   item.Update();
        }
开发者ID:Kahltor,项目名称:ExpirationPolicies,代码行数:7,代码来源:ExpirationAction.cs

示例2: CopyFolder

 private void CopyFolder()
 {
     _SourceFolder.CopyTo(_NewUrl);
     _Folder = _SPWeb.GetFolder(_NewUrl);
     _Item = _Folder.Item;
     _Item["ContentTypeId"] = _ContentTypeId;
     _Item.Update();
 }
开发者ID:jjaramillo,项目名称:Jjaramillo.SP2013,代码行数:8,代码来源:CopyFolderCommand.cs

示例3: RestoreFolder

 private void RestoreFolder()
 {            
     _Folder.MoveTo(_OldUrl);
     _Folder = _SPWeb.GetFolder(_OldUrl);
     _Item = _Folder.Item;
     _Item["ContentTypeId"] = _ContentTypeId;
     _Item.Update();
 }
开发者ID:jjaramillo,项目名称:Jjaramillo.SP2013,代码行数:8,代码来源:MoveFolderCommand.cs

示例4: ApplyInstanceTo

 public void ApplyInstanceTo(SPListItem listItem)
 {
     listItem[SPBuiltInFieldId.Title] = Name;
     listItem[SPBuiltInFieldId.ContentTypeId] = new SPContentTypeId("0x0100f85afb7885a94beda6ffc9240fe3b123");
     listItem[new Guid("{049456A6-A6EE-4C2C-A20F-08FEC557575A}")] = Color;
     listItem[new Guid("{5742D21D-3508-47BD-A646-6180D73BF144}")] = Price;
     listItem[new Guid("{6F6E8AAC-8A3C-4EDE-B841-F03C727A4C77}")] = ProductNo;
     listItem.Update();
 }
开发者ID:ThorstenHans,项目名称:DotNetRocks,代码行数:9,代码来源:Product.cs

示例5: ApplyInstanceTo

 public void ApplyInstanceTo(SPListItem listItem)
 {
     listItem[SPBuiltInFieldId.ContentTypeId] = SPBuiltInContentTypeId.Contact;
     listItem[SPBuiltInFieldId.Title] = this.LastName;
     listItem[SPBuiltInFieldId.FirstName] = this.FirstName;
     listItem[SPBuiltInFieldId.Company] = this.Company;
     listItem[SPBuiltInFieldId.JobTitle] = this.Job;
     listItem[SPBuiltInFieldId.EMail] = this.Email;
     listItem.Update();
 }
开发者ID:ThorstenHans,项目名称:DotNetRocks,代码行数:10,代码来源:Contact.cs

示例6: ApplyInstanceTo

 public void ApplyInstanceTo(SPListItem item)
 {
     item[SPBuiltInFieldId.ContentTypeId] = SPBuiltInContentTypeId.Contact;
     item[SPBuiltInFieldId.Title] = LastName;
     item[SPBuiltInFieldId.FirstName] = FirstName;
     item[SPBuiltInFieldId.Company] = Company;
     item[SPBuiltInFieldId.EMail] = Email;
     item[SPBuiltInFieldId.HomePhone] = Phone;
     item.Update();
 }
开发者ID:ThorstenHans,项目名称:DotNetRocks,代码行数:10,代码来源:Vendor.cs

示例7: ApplyPageValues

        private static void ApplyPageValues(SPListItem item, IPageInfo page)
        {
            if (page.Values != null)
            {
                foreach (FieldValueInfo value in page.Values)
                {
                    value.ApplyOnItem(item);
                }
            }

            item.Update();
        }
开发者ID:GAlexandreBastien,项目名称:Dynamite-2010,代码行数:12,代码来源:FolderMaker.cs

示例8: StartWorkflow

 //method to start the workflow
 private static void StartWorkflow(SPListItem listItem, string workflowName, Guid siteId)
 {
     try
     {
         SPWorkflowAssociation wfAssoc = listItem.ParentList.WorkflowAssociations.GetAssociationByName(workflowName, System.Globalization.CultureInfo.CurrentCulture);
         listItem.Web.Site.WorkflowManager.StartWorkflow(listItem, wfAssoc, wfAssoc.AssociationData, true);
         listItem.Update();
     }
     catch (Exception ex)
     {
         Common.LogError("NiemProjectInfoEventHandlerEventReceiver.StartWorkflow", ex, siteId);
     }
 }
开发者ID:NIEM-Web,项目名称:Sharepoint,代码行数:14,代码来源:NIEMProjectInfoEventHandler.cs

示例9: AddAttachment

        void AddAttachment(SPListItem item, string content, string leafName, bool deleteBefore)
        {
            base.EventFiringEnabled = false;

            try {
                if (!string.IsNullOrEmpty(content)) {

                    var bytes = new UTF8Encoding().GetBytes(content);

                    if (deleteBefore) {
                        item.Attachments.DeleteNow(leafName);
                        item.Update();
                    }

                    item.Attachments.Add(leafName, bytes);
                    item.Update();
                }
            }
            finally {
                base.EventFiringEnabled = true;
            }
        }
开发者ID:tstojecki,项目名称:JEFS,代码行数:22,代码来源:EventReceiver.cs

示例10: FolderExists

        public static void FolderExists(SPWeb web, string folderName, SPList list, SPListItem listItem)
        {
            //Check folder exist in the SPWeb or not

            SPListItem listFolder = null;
            bool folderExists = false;
            // Check to see if folder already exists, if not create it
            for (int i = 0; i < list.Folders.Count; i++)
            {
                if (list.Folders[i].Folder.Name == folderName)
                {
                    listFolder = list.Folders[i];
                    listItem = list.Items.Add(listFolder.Folder.ServerRelativeUrl, SPFileSystemObjectType.File, null);
                    web.AllowUnsafeUpdates = true;
                    listItem.Update();
                }
            }

            // The folder does not exist so we create it and add the item

            if (!folderExists)
            {
                listFolder = list.Items.Add(list.RootFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder, folderName);
                listFolder.Update();
                listFolder["Title"] = folderName;

                SPListItem newListItem = list.Items.Add(listFolder.Folder.ServerRelativeUrl, SPFileSystemObjectType.File, null);
                web.AllowUnsafeUpdates = true;
                foreach (SPField field in listItem.Fields)
                {
                    if (field.ReadOnlyField
                     || field.Id == SPBuiltInFieldId.Attachments)
                        continue;
                    newListItem[field.Id] = listItem[field.Id];
                }

                newListItem.Update();

                list.Update();
            }
        }
开发者ID:fraczo,项目名称:bba-pumps,代码行数:41,代码来源:Folders.cs

示例11: SetUp

        public override void SetUp()
        {
            base.TestFixtureSetUp();
            roomList = web.Lists["Rooms"];
            var roomItem1 = roomList.Items.Add();
            roomItem1["Room Number"] = "Room 1";
            roomItem1.Update();
            roomId1 = roomItem1.ID;

            var roomItem2 = roomList.Items.Add();
            roomItem2["Room Number"] = "Room 2";
            roomItem2.Update();
            roomId2 = roomItem2.ID;

            assetList = web.Lists["Assets"];
            assetItem = assetList.Items.Add();
            assetItem["Room"] = new SPFieldLookupValue(roomId1, null);
            assetItem.Update();

            lookupField = new LookupFieldValue(new SPListItemWrapper(assetItem), "Room");
        }
开发者ID:danielalexandrecosta,项目名称:domaindrivensharepoint,代码行数:21,代码来源:WhenUsingLookupFieldValueToWrapSPFieldLookup.cs

示例12: Import_Faktura

        internal static void Import_Faktura(SPListItem item, int okresId)
        {
            int klientId = 0;
            string fileName = item.File.Name;

            string nazwaSkrocona = Extract_NazwaSkrocona(fileName);

            if (!String.IsNullOrEmpty(nazwaSkrocona))
            {
                klientId = BLL.tabKlienci.Get_KlientId(item.Web, nazwaSkrocona);
            }

            if (klientId > 0)
            {
                //item["Title"] = tabKlienci.Get_KlientById(item.Web, klientId).Title;
                item["Title"] = String.Empty;
                item["selKlient"] = klientId;
                item["selOkres"] = okresId;

                int zadanieId = BLL.tabZadania.Get_NumerZadaniaBR(item.Web, klientId, okresId);

                if (zadanieId > 0)
                {
                    item["selZadanie"] = zadanieId;
                    bool attResult = BLL.tabZadania.Add_FileFromURL(item.Web, zadanieId, item.File);
                }
            }
            else
            {
                item["Title"] = "niezgodna nazwa pliku";
                item["selKlient"] = 0;
                item["selOkres"] = 0;
                item["selZadanie"] = 0;
            }

            item.Update();
        }
开发者ID:fraczo,项目名称:Biuromagda,代码行数:37,代码来源:ImportFaktur.cs

示例13: ShareItem

 /// <summary>
 /// This method marks the current Item as shared
 /// </summary>
 /// <param name="site">SPWeb</param>
 /// <param name="item">SPListItem</param>
 /// <param name="Shared">bool</param>
 public static void ShareItem(SPWeb site, SPListItem item, bool Shared)
 {
     item.BreakRoleInheritance(true);
     site.AllowUnsafeUpdates = true;
     SPFieldUrlValue value = new SPFieldUrlValue();
     //Remove all existing RoleAssignments
     for (int i = item.RoleAssignments.Count - 1; i >= 0; i--)
     {
         item.RoleAssignments.Remove(item.RoleAssignments[i].Member);
     }
     if (Shared == true)
     {
         SPList siteList = site.Lists["Shared Documents"];
         for (int i = siteList.RoleAssignments.Count - 1; i >= 0; i--)
         {
             item.RoleAssignments.Add(siteList.RoleAssignments[i]);
         }
         value.Description = "Shared";
         value.Url = SPHelper.GetRootUrl(SPContext.Current.Web.Url) + "_layouts/IMAGES/sharedoc.gif";
     }
     else
     {
         value.Description = "Private";
         value.Url = SPHelper.GetRootUrl(SPContext.Current.Web.Url) + "_layouts/IMAGES/bizdataactionicon.gif";
     }
     item["Access Level"] = value;
     item.Update();
     site.AllowUnsafeUpdates = false;
     site.Update();
 }
开发者ID:infinitimods,项目名称:clif-sharepoint,代码行数:36,代码来源:SPHelper.cs

示例14: UpdateSourceItem

 /// <summary>
 /// This method updates List item in the document library
 /// </summary>
 /// <param name="Item">SPListItem</param>
 /// <param name="Web">SPWeb</param>
 private void UpdateSourceItem(SPListItem Item, SPWeb Web, string PID)
 {
     Web.AllowUnsafeUpdates = true;
     Item["Persistent ID"] = PID;
     Item["Publishable Status"] = "Published";
     Item.Update();
 }
开发者ID:infinitimods,项目名称:clif-sharepoint,代码行数:12,代码来源:PublishDocument.cs

示例15: UpdateUserPermission

        public static void UpdateUserPermission(SPWeb web, bool isBreakRole, SPListItem item, string LoginName, string RoleDefinition)
        {
            web.AllowUnsafeUpdates = true;

            if (isBreakRole)
            {
                item.ResetRoleInheritance();
                item.Update();

                if (!item.HasUniqueRoleAssignments)
                    item.BreakRoleInheritance(false);
            }

            SPRoleDefinition SPRoleDefinitionData = item.Web.RoleDefinitions[RoleDefinition];

            string[] split = LoginName.Split(';');
            foreach (string s in split)
            {
                SPRoleAssignment RoleAssignment = new SPRoleAssignment(s, string.Empty, string.Empty, string.Empty);
                RoleAssignment.RoleDefinitionBindings.Add(SPRoleDefinitionData);
                item.RoleAssignments.Add(RoleAssignment);
            }

            item.Update();
        }
开发者ID:chutinhha,项目名称:spvisionet,代码行数:25,代码来源:Util.cs


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