0 out of 1 rated this helpful - Rate this topic

SPField.Delete Method

Deletes the field.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
[ClientCallableExceptionConstraintAttribute(FixedId = "3", ErrorType = typeof(InvalidOperationException), 
	Condition = "The field cannot be deleted because it does not allow deletion.")]
[ClientCallableExceptionConstraintAttribute(FixedId = "8", ErrorCode = , Condition = "The field cannot be deleted because it is a read only field in the list.", 
	ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "accessdenied", Condition = "Lack of permissions to perform the operation.", 
	ErrorType = typeof(UnauthorizedAccessException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "5", ErrorCode = , Condition = "The field cannot be deleted because it is inherited from the list's base type.", 
	ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "2", ErrorType = typeof(ArgumentException), 
	Condition = "The field cannot be deleted because it does not exist in the list.")]
[ClientCallableMethodAttribute(Name = "DeleteObject", RemoveThisObjectFromParentCollection = true)]
[ClientCallableExceptionConstraintAttribute(FixedId = "7", ErrorCode = , Condition = "The field cannot be deleted because it is a sealed field in the list.", 
	ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "1", ErrorType = typeof(SPException), 
	Condition = "The field cannot be deleted because it is a primary lookup field with dependent lookups OR a read only field in the list.", 
	ErrorCode = )]
[ClientCallableExceptionConstraintAttribute(FixedId = "thresholdexceeded", ErrorCode = , Condition = "Operation exceeds the list view threshold enforced by the administrator.", 
	ErrorType = typeof(SPQueryThrottledException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "6", ErrorCode = , Condition = "The field cannot be deleted because it is a hidden field in the list.", 
	ErrorType = typeof(SPException))]
public void Delete()
Exception Condition
ArgumentException

The field cannot be found.

InvalidOperationException

The field cannot be deleted.

SPException

The field collection containing this field is read-only.

This method calls the Delete(String) method to delete the field.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ