本文整理汇总了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();
}
示例2: CopyFolder
private void CopyFolder()
{
_SourceFolder.CopyTo(_NewUrl);
_Folder = _SPWeb.GetFolder(_NewUrl);
_Item = _Folder.Item;
_Item["ContentTypeId"] = _ContentTypeId;
_Item.Update();
}
示例3: RestoreFolder
private void RestoreFolder()
{
_Folder.MoveTo(_OldUrl);
_Folder = _SPWeb.GetFolder(_OldUrl);
_Item = _Folder.Item;
_Item["ContentTypeId"] = _ContentTypeId;
_Item.Update();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
}
示例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;
}
}
示例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();
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}