共用方式為


AddWPPack Method

The AddWPPack method of the SPGlobalAdmin class either enables a Web Part Package that is already installed on the virtual server and adds it to the Web Part gallery, or installs and enables a Web Part Package and adds it to the Web Part gallery.

Parameters

strPathname    A string that contains the full file system path for the Web Part Package to install. If not specified, then strName must be specified. The strPathname parameter is used in conjunction with the strURL parameter. If strURL contains null, the Web Part Package is installed on all virtual servers on the front-end Web server; otherwise, the package is installed on the virtual server specified by strURL.

strBaseName    A string that contains the file name of the installed Web Part Package to enable. If not specified, then strPathname must be specified. The strName parameter is used in conjunction with the strURL parameter. If strURL contains null, the Web Part Package is enabled for all virtual servers on the front-end Web server; otherwise, the package is enabled for the virtual server specified by strURL.

nLang   An unsigned 32-bit integer that specifies the locale ID for the Web Part Package. This parameter can be 0 or any valid LCID (1033 for English).

strURL    A string that contains the URL for the virtual server. The strURL parameter is used in conjunction with the strName or strPathname parameter. If strURL is set to null, the Web Part Package specified by the strName parameter is enabled for all virtual servers on the front-end Web server, or the Web Part Package specified by the strPathname parameter is installed on all virtual servers on the front-end Web server.

bGlobalInstall   true to install the Web Part Package to each front-end Web server in a server farm; otherwise, false.

bForce   true to overwrite an existing Web Part Package with a new version; otherwise, false.

logWriter   A System.IO.TextWriter object that is used to write an error log to the text stream. This parameter can contain null.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security