I have written a code relying on Managed Client Object Model which performs the following actions:
- Creates a site
Web site - Creates a list
List list1 - Creates a list field
FieldText field1(which is a field oflist1list) - Creates a list field
FieldNumber field2(which is a field oflist1list) - Creates another list
List list2 - Calls
clientContext.ExecuteQuery()which orders the SharePoint to actually create all these SharePoint components.
I want to achieve the following:
If for some reason something goes wrong while creating field2, i.e. in the step 4, I want my code to cancel the creation of list1, field1 and field2, but I still want the site and list2 to have created.
I see the clientContext as a kind of a container where I can stack my commands and then call the ExecuteQuery method which processes these commands, i.e. pushes them to SharePoint. If I am correct, then my problem is that I am unable to clear certain commands stacked inside the clientContext object. I need to have them removed before the query gets executed. Can you show me how? Thanks.