共用方式為


SPFarm.GetObject Method (String, Guid, Type)

Returns the specified object based on its associated name, GUID, and type.

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

Syntax

'Declaration
Public Function GetObject ( _
    name As String, _
    parentId As Guid, _
    type As Type _
) As SPPersistedObject
'Usage
Dim instance As SPFarm
Dim name As String
Dim parentId As Guid
Dim type As Type
Dim returnValue As SPPersistedObject

returnValue = instance.GetObject(name, _
    parentId, type)
public SPPersistedObject GetObject(
    string name,
    Guid parentId,
    Type type
)

Parameters

  • name
    Type: System.String

    A string that contains the name of the object.

  • parentId
    Type: System.Guid

    A System.Guid that identifies the parent of the object.

  • type
    Type: System.Type

    A System.Type that represents the type of the object.

Return Value

Type: Microsoft.SharePoint.Administration.SPPersistedObject
An SPPersistedObject object that represents the object that is associated with the GUID and type.

Remarks

To return a Web application object called MyWeb, call the GetObject method as follows:

SPFarm.GetObject("MyWeb", SPWebService, SpWebApplication)

See Also

Reference

SPFarm Class

SPFarm Members

GetObject Overload

Microsoft.SharePoint.Administration Namespace