PageLayoutCollection.Add PageLayoutCollection.Add PageLayoutCollection.Add Method

Definition

Overloads

Add(String, SPContentTypeId) Add(String, SPContentTypeId) Add(String, SPContentTypeId)

Creates and adds a new PageLayout object.

Add(String, SPContentTypeId, String) Add(String, SPContentTypeId, String) Add(String, SPContentTypeId, String)

Creates and adds a new PageLayout object.

Add(String, SPContentTypeId) Add(String, SPContentTypeId) Add(String, SPContentTypeId)

Creates and adds a new PageLayout object.

public:
 Microsoft::SharePoint::Publishing::PageLayout ^ Add(System::String ^ pageLayoutName, Microsoft::SharePoint::SPContentTypeId associatedContentTypeId);
public Microsoft.SharePoint.Publishing.PageLayout Add (string pageLayoutName, Microsoft.SharePoint.SPContentTypeId associatedContentTypeId);
Public Function Add (pageLayoutName As String, associatedContentTypeId As SPContentTypeId) As PageLayout
Parameters
pageLayoutName
String String String

Name of PageLayout.

associatedContentTypeId
SPContentTypeId SPContentTypeId SPContentTypeId

Identifier (ID) of the SPContentType that this PageLayout will be associated with.

Returns

The newly created PageLayout.

Exceptions

The File or folder name "%1" contains characters that are not permitted. Please use a different name.

The specified file or folder name is too long. The URL path for all files and folders must be 260 characters or less (and no more than 128 characters for any single file or folder name in the URL). Please type a shorter file or folder name.

Indicates that one of the input parameters is a null reference (Nothing in Visual Basic).

The current user does not have sufficient permissions to perform this action.

Indicates that another file with the same name already exists.

Remarks

The pageLayoutName parameter can either have no file name extension or an .aspx extension. The pageLayoutName value must not be empty and cannot exceed 128 characters. The name must also be unique within the master page gallery of the SPSite.RootWeb site. The pageLayoutName value cannot contain any of the following invalid characters:, ", #, %, *, :, <, >, ?, </strong>, /, {, |, } or an ampersand or ASCII character 0x7f. The associatedContentTypeId value must identify a valid SPContentType on the SPSite.RootWeb site.

Add(String, SPContentTypeId, String) Add(String, SPContentTypeId, String) Add(String, SPContentTypeId, String)

Creates and adds a new PageLayout object.

public:
 Microsoft::SharePoint::Publishing::PageLayout ^ Add(System::String ^ pageLayoutName, Microsoft::SharePoint::SPContentTypeId associatedContentTypeId, System::String ^ pageMarkup);
public Microsoft.SharePoint.Publishing.PageLayout Add (string pageLayoutName, Microsoft.SharePoint.SPContentTypeId associatedContentTypeId, string pageMarkup);
Public Function Add (pageLayoutName As String, associatedContentTypeId As SPContentTypeId, pageMarkup As String) As PageLayout
Parameters
pageLayoutName
String String String

Name of PageLayout.

associatedContentTypeId
SPContentTypeId SPContentTypeId SPContentTypeId

The identifier (ID) of the SPContentType that this PageLayout will be associated with.

pageMarkup
String String String

ASPX markup for the page layout, or a null reference (Nothing in Visual Basic) to indicate that markup from the template page layout should be used.

Returns

The newly created PageLayout object.

Exceptions

The File or folder name "%1" contains characters that are not permitted. Please use a different name.

The specified file or folder name is too long. The URL path for all files and folders must be 260 characters or less (and no more than 128 characters for any single file or folder name in the URL). Please type a shorter file or folder name.

Indicates that one of the input parameters is a null reference (Nothing in Visual Basic).

Current user does not have sufficient permissions to perform this action.

Indicates that another file with the same name already exists.

Remarks

The pageLayoutName parameter can either have no file name extension or an .aspx extension. The pageLayoutName value must not be empty and cannot exceed 128 characters. The name must also be unique within the master page gallery of the SPSite.RootWeb site. The pageLayoutName cannot contain any of the following invalid characters: ", #, %, *, :, <, >, ?, </strong>, /, {, |, } or an ampersand or ASCII character 0x7f. The associatedContentTypeId value must identify a valid SPContentType on the SPSite.RootWeb site.

Applies to