共用方式為


SPFile.GetLimitedWebPartManager Method

Returns the Web Part manager that is associated with the Web Parts page.

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

Syntax

'Declaration
<ClientCallableMethodAttribute(CacheReturnValue := True)> _
<ClientCallableExceptionConstraintAttribute(FixedId := "1", ErrorType := GetType(ArgumentOutOfRangeException),  _
    Condition := "scope for the asp page must be either User or Shared")> _
<ClientCallableExceptionConstraintAttribute(FixedId := "2", ErrorType := GetType(ArgumentNullException),  _
    Condition := "1)Input Uri must not be null\n2)Page Url must not be relative Url")> _
<ClientCallableExceptionConstraintAttribute(FixedId := "3", ErrorType := GetType(ArgumentException),  _
    Condition := "Input Uri must be absolute")> _
<ClientCallableExceptionConstraintAttribute(FixedId := "4", ErrorType := GetType(FileNotFoundException),  _
    Condition := "New instance of initialstate webpartmanager must exist")> _
<ClientCallableExceptionConstraintAttribute(FixedId := "5", ErrorType := GetType(SPException),  _
    Condition := "1)Url extension is null\n2)Url extension is empty
3)Url extension is not aspx
4)Url extension is not master or ascx and url extension is not allowmasterpage")> _
<SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.UnsupportedSPType)> _
Public Function GetLimitedWebPartManager ( _
    scope As PersonalizationScope _
) As SPLimitedWebPartManager
'Usage
Dim instance As SPFile
Dim scope As PersonalizationScope
Dim returnValue As SPLimitedWebPartManager

returnValue = instance.GetLimitedWebPartManager(scope)
[ClientCallableMethodAttribute(CacheReturnValue = true)]
[ClientCallableExceptionConstraintAttribute(FixedId = "1", ErrorType = typeof(ArgumentOutOfRangeException), 
    Condition = "scope for the asp page must be either User or Shared")]
[ClientCallableExceptionConstraintAttribute(FixedId = "2", ErrorType = typeof(ArgumentNullException), 
    Condition = "1)Input Uri must not be null\n2)Page Url must not be relative Url")]
[ClientCallableExceptionConstraintAttribute(FixedId = "3", ErrorType = typeof(ArgumentException), 
    Condition = "Input Uri must be absolute")]
[ClientCallableExceptionConstraintAttribute(FixedId = "4", ErrorType = typeof(FileNotFoundException), 
    Condition = "New instance of initialstate webpartmanager must exist")]
[ClientCallableExceptionConstraintAttribute(FixedId = "5", ErrorType = typeof(SPException), 
    Condition = "1)Url extension is null\n2)Url extension is empty
3)Url extension is not aspx
4)Url extension is not master or ascx and url extension is not allowmasterpage")]
[SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.UnsupportedSPType)]
public SPLimitedWebPartManager GetLimitedWebPartManager(
    PersonalizationScope scope
)

Parameters

  • scope
    Type: System.Web.UI.WebControls.WebParts.PersonalizationScope

    A System.Web.UI.WebControls.WebParts.PersonalizationScope value that specifies either Shared, meaning that personalization data applies to all users and can be saved, or User, meaning that both user-specific personalization data, and personalization data that applies to all users, is loaded for controls on the page, but that only user-specific data can be saved.

Return Value

Type: Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager
An SPLimitedWebPartManager object that represents the Web Part manager.

Remarks

Calling the GetLimitedWebPartManager method on a non-.aspx page throws an exception.

See Also

Reference

SPFile Class

SPFile Members

Microsoft.SharePoint Namespace