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.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.
configXml
Type: System.StringSettings to use for the conversion.
priority
Type: Microsoft.SharePoint.Publishing.PageConversionPriorityPriority level for the conversion. 0 indicates that the conversion happens immediately.
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