Share via


PublishingPageCollection.Add Method (String, SPFile, Guid, String, PageConversionPriority)

Creates a new PublishingPage in the PublishingPageCollection of the PublishingWeb b by converting a source document according to the settings that are passed.

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, _
    configXml As String, _
    priority As PageConversionPriority _
) As PublishingPage
'Usage
Dim instance As PublishingPageCollection
Dim newPageName As String
Dim fileToConvert As SPFile
Dim transformerId As Guid
Dim configXml As String
Dim priority As PageConversionPriority
Dim returnValue As PublishingPage

returnValue = instance.Add(newPageName, _
    fileToConvert, transformerId, configXml, _
    priority)
public PublishingPage Add(
    string newPageName,
    SPFile fileToConvert,
    Guid transformerId,
    string configXml,
    PageConversionPriority priority
)

Parameters

  • newPageName
    Type: System.String
    Name of the new PublishingPage.
  • transformerId
    Type: System.Guid
    Document transformer ID to use for the conversion.
  • configXml
    Type: System.String
    Settings to use 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 issue a warning, such as when embedded images get dropped, it throws this exception. This exception should always be caught by the caller.

If the PublishingPage member of this exception is not null, the issue that caused the exception is a converter warning. The page can be used with the caveat that it has 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.

This method is identical to Add(stringnewpageName, SPFilefileToConvert, GuidtranformerId, PageConversionPrioritypriority) except that this version takes settings from the configXml parameter and not from the configuration of the content type.

This method can throw all exceptions that Add(stringname, PageLayoutlayout) throws plus DocumentToPublishingPageConversionException.

See Also

Reference

PublishingPageCollection Class

PublishingPageCollection Members

Add Overload

Microsoft.SharePoint.Publishing Namespace

Add

Add

DocumentToPublishingPageConversionException