using
(SPSite oSite= new SPSite(SPContext.Current.Site.Url"))
{
using
(SPWeb oWeb = oSite.OpenWeb())
{
SPList
oList = oWeb.Lists.TryGetList("MyListName");
SPListItem
oListItem = oList.Items.Add();
oListItem["Column1"]
= "Value1";
oListItem["Column2"]
= "Value2";
oListItem.Update();
//oListItem.SystemUpdate();
//oListItem.SystemUpdate(true);
//oListItem.SystemUpdate(false);
}
}
--->In
the above code,oListItem.Update()will
update the “MyListName” data. This will also update the built in
columns “Modified”
and “Modified
By”
--->oListItem.SystemUpdate(),this
will update the “MyListName”
databut
not
the built in columns “Modified” and “Modified By”.
--->oListItem.SystemUpdate(true),this
will update the “MyListName” data
but not the built in columns “Modified” and “Modified By”.But
it will increment the item
version
---->oListItem.SystemUpdate(false),this will update the “MyListName” data but not the built in columns “Modified” and “Modified By”. Also, does not increment the item verision
---->oListItem.SystemUpdate(false),this will update the “MyListName” data but not the built in columns “Modified” and “Modified By”. Also, does not increment the item verision
SystemUpdate
will trigger all the list events if any and also the changes can be
observed in Audit logs. Only alerts will not be triggered that are
configured on the list..
If
we are using SharePoint Object Model, as per the business needs we
have to use any of the Methods.
But,if we are using client object model only Update method will be available, SystemUpdate method will not be available.
But,if we are using client object model only Update method will be available, SystemUpdate method will not be available.
0 comments:
Post a Comment