IAppxPackageWriter::AddPayloadFile method
Adds a new payload file to the app package.
Syntax
HRESULT AddPayloadFile( [in] LPCWSTR fileName, [in] LPCWSTR contentType, [in] APPX_COMPRESSION_OPTION compressionOption, [in] IStream *inputStream );
Parameters
- fileName [in]
-
Type: LPCWSTR
The name of the payload file. The file name path must be relative to the root of the package.
- contentType [in]
-
Type: LPCWSTR
The string specifying the content type of fileName.
- compressionOption [in]
-
Type: APPX_COMPRESSION_OPTION
The type of compression to use to store fileName in the package.
- inputStream [in]
-
Type: IStream*
An IStream providing the contents of fileName. The stream must support Read, Seek, and Stat.
Return value
Type: HRESULT
If the method succeeds, it returns S_OK. Otherwise, it returns an error code that includes, but is not limited to, those in the following table. Error OPC codes, in addition to OPC_E_DUPLICATE_PART may result. If the method fails, the package writer will close in a failed state and can't be used any more.
| Return code | Description |
|---|---|
|
The compression option specified by compressionOption is not one of the values of the APPX_COMPRESSION_OPTION enumeration. |
|
The writer is closed. |
|
The file name specified is not a valid file name or is a reserved name for a footprint file. |
|
The file name specified is already in use in the package. |
Remarks
When the AddPayloadFile method succeeds the contents of the specified fileName are written to the package and a corresponding entry is made in the package block map.
Examples
For an example, see How to create an app package.
Requirements
|
Minimum supported client |
Windows 8 [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2012 [desktop apps only] |
|
Header |
|
|
IDL |
|
|
IID |
IID_IAppxPackageWriter is defined as 9099e33b-246f-41e4-881a-008eb613f858 |
See also