DataContext.SubmitChanges Method
Persists to the content database changes made by the current user to one or more lists; or, if a concurrency conflict is found, populates the ChangeConflicts property.
Namespace: Microsoft.SharePoint.Linq
Assembly: Microsoft.SharePoint.Linq (in Microsoft.SharePoint.Linq.dll)
Syntax
'Declaration
Public Sub SubmitChanges
'Usage
Dim instance As DataContext
instance.SubmitChanges()
public void SubmitChanges()
Exceptions
Exception | Condition |
---|---|
InvalidOperationException | ObjectTrackingEnabled is false - or - At least one conflict in ChangeConflicts from the last time SubmitChanges() was called is not yet resolved. |
ChangeConflictException | There is a concurrency conflict. |
Remarks
This overload of SubmitChanges() will use FailOnFirstConflict as the failure mode. To persist changes with a different mode, use SubmitChanges(ConflictMode) or SubmitChanges(ConflictMode, Boolean),
The version of changed list items will be incremented. To persist changes without incrementing versions, use SubmitChanges(ConflictMode, Boolean).
Examples
The following example shows this overload of SubmitChanges() being used:
foreach (TeamMember teamMember in teamSite.TeamMembers)
{
teamMember.TopTask = “Fiscal Planning”;
}
try
{
teamSite.SubmitChanges();
}
catch (ChangeConflictException e)
{
teamSite.ChangeConflicts.ResolveAll();
teamSite.SubmitChanges();
}
For Each teamMember As TeamMember In teamSite.TeamMembers
teamMember.TopTask = "Fiscal Planning"
Next teamMember
Try
teamSite. SubmitChanges()
Catch e As ChangeConflictException
teamSite.ChangeConflicts.ResolveAll()
teamSite. SubmitChanges()
End Try