Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
UnPublish Method

SPFile.UnPublish Method

Removes the file with the specified comment from content approval.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

[ClientCallableExceptionConstraintAttribute(FixedId = "10", ErrorType = typeof(SPDuplicateValuesFoundException), 
	ErrorCode = , Condition = "The list item could not be updated because duplicate values were found for one or more field(s) in the list")]
[ClientCallableExceptionConstraintAttribute(FixedId = "8", ErrorType = typeof(SPFileLockException), 
	ErrorCode = , Condition = "The operation timed out")]
[ClientCallableExceptionConstraintAttribute(FixedId = "12", ErrorType = typeof(UnauthorizedAccessException), 
	Condition = "Lack of permission to perform the operation")]
[ClientCallableAttribute]
[ClientCallableExceptionConstraintAttribute(FixedId = "4", ErrorType = typeof(SPFileCheckOutException), 
	ErrorCode = , Condition = "The file is already checked out")]
[ClientCallableExceptionConstraintAttribute(FixedId = "5", ErrorType = typeof(SPFileCheckOutException), 
	ErrorCode = , Condition = "The file is not checked out")]
[ClientCallableExceptionConstraintAttribute(FixedId = "6", ErrorType = typeof(SPFileLockException), 
	ErrorCode = , Condition = "There is an exclusive lock on the file")]
[ClientCallableExceptionConstraintAttribute(FixedId = "7", ErrorType = typeof(SPFileLockException), 
	ErrorCode = , Condition = "There is a shared lock on the file")]
[ClientCallableExceptionConstraintAttribute(FixedId = "9", ErrorType = typeof(SPFileLockException), 
	ErrorCode = , Condition = "The file is not locked")]
[ClientCallableExceptionConstraintAttribute(FixedId = "11", ErrorType = typeof(SPInvalidLookupValuesException), 
	ErrorCode = , Condition = "The list item could not be updated because because invalid lookup values were found for one or more field(s) in the list")]
public void UnPublish(
	string comment
)

Parameters

comment
Type: System.String

A string that contains the comment.

ExceptionCondition
SPException

The list item associated with the file is null .

-or-

The SPList in which the list item is located does not support minor versions.

-or-

The value of the CheckOutType is Online.

-or-

The moderated list is an unpublished document, which is not pending or approved.

-or-

The nonmoderated list is an unpublished document, which is not a major version.

-or-

An error occurred when removing the file.

Show:
© 2015 Microsoft