PublishingPageCollection.Add Method (String, SPFile, Guid, PageConversionPriority)
Creates a new PublishingPage in the PublishingPageCollection of the PublishingWeb by converting a source document.
Namespace: Microsoft.SharePoint.Publishing
Assembly: Microsoft.SharePoint.Publishing (in Microsoft.SharePoint.Publishing.dll)
Syntax
'Declaration
Public Function Add ( _
newPageName As String, _
fileToConvert As SPFile, _
transformerId As Guid, _
priority As PageConversionPriority _
) As PublishingPage
'Usage
Dim instance As PublishingPageCollection
Dim newPageName As String
Dim fileToConvert As SPFile
Dim transformerId As Guid
Dim priority As PageConversionPriority
Dim returnValue As PublishingPage
returnValue = instance.Add(newPageName, _
fileToConvert, transformerId, priority)
public PublishingPage Add(
string newPageName,
SPFile fileToConvert,
Guid transformerId,
PageConversionPriority priority
)
Parameters
newPageName
Type: System.StringName of the new PublishingPage.
fileToConvert
Type: Microsoft.SharePoint.SPFileFile to convert to get the page content.
transformerId
Type: System.GuidDocument transformer ID to use for the conversion.
priority
Type: Microsoft.SharePoint.Publishing.PageConversionPriorityPageConversionPriority enumeration for the conversion.
Return Value
Type: Microsoft.SharePoint.Publishing.PublishingPage
The newly created PublishingPage.
Exceptions
Exception | Condition |
---|---|
DocumentToPublishingPageConversionException | If the conversion fails or encounters problems that cause the converter to throw. For example, this exception appears when embedded images get dropped. This exception should always be caught by the caller. If the PublishingPage member of the thrown exception is not null, the issue that causes the exception is a converter warning, and the page can be used with the caveat that it may have potentially significant fidelity issues, depending on the converter warning. |
Remarks
Uses the smart client authoring feature to add a page by converting a specified document to HTML. The smart client authoring feature specifies the settings to use, such as what page layout to use for the new page and which field to store the converted HTML in.
The return value and exceptions are identical to those for the Add(stringname, PageLayoutlayout) function that takes the new name and layout directly, with the addition of the DocumentToPublishingPageConversionException that is sometimes thrown.
See Also
Reference
PublishingPageCollection Class