共用方式為


Packaging Errors

A complete list of Packaging API errors.

Return code/value Description
OPC_E_CONFLICTING_SETTINGS
0x80510014
The selected package creation settings are inconsistent; an example would be creating a package that uses both Force 32-bit mode and Force 64-bit mode.
OPC_E_COULD_NOT_RECOVER
0x8051004E
Errors that occurred during previous operations prevent the requested operation from completing. Future attempts to perform the operation that triggered this error, or attempts to perform related operations, will fail.
OPC_E_DS_DEFAULT_DIGEST_METHOD_NOT_SET
0x80510047
The default digest method has not been set; to set it, call IOpcSigningOptions::SetDefaultDigestMethod.
OPC_E_DS_DIGEST_VALUE_ERROR
0x8051001A
Cannot get the digest value of a package component or an element in the signature markup that was referenced for signing.
OPC_E_DS_DUPLICATE_PACKAGE_OBJECT_REFERENCES
0x8051002D
The signature markup contains more than one Reference element that refers to the package Object element, but only one such Reference is allowed.
OPC_E_DS_DUPLICATE_SIGNATURE_ORIGIN_RELATIONSHIP
0x8051001B
More than one relationship of the digital signature origin relationship type exists, but only one such relationship is allowed.
For more information about this relationship type, see the OPC.
OPC_E_DS_DUPLICATE_SIGNATURE_PROPERTY_ELEMENT
0x80510028
The signature markup contains more than one SignatureProperty element that has the same Id attribute.
OPC_E_DS_EXTERNAL_SIGNATURE
0x8051001E
A relationship whose target is a Signature part has the external target mode; Signature parts must be inside of the package.
OPC_E_DS_EXTERNAL_SIGNATURE_REFERENCE
0x8051002F
A Reference element in the signature markup refers to an object that is external to the package. Reference elements must point to parts or Object elements that are internal.
OPC_E_DS_INVALID_CANONICALIZATION_METHOD
0x80510022
An unsupported canonicalization method was requested or used in a signature.
OPC_E_DS_INVALID_CERTIFICATE_RELATIONSHIP
0x8051001D
A relationship of type digital signature certificate has the external target mode.
For more information about this relationship type, see the OPC.
OPC_E_DS_INVALID_OPC_SIGNATURE_TIME_FORMAT
0x80510024
The signature's time format is not a valid OPC_SIGNATURE_TIME_FORMAT enumeration value.
OPC_E_DS_INVALID_RELATIONSHIP_TRANSFORM_XML
0x80510021
A Transform element that indicates the use of the relationships transform and the selection criteria for the transform does not conform to the schema specified in the OPC.
OPC_E_DS_INVALID_RELATIONSHIPS_SIGNING_OPTION
0x80510023
An indicated relationship signing option is not a valid OPC_RELATIONSHIPS_SIGNING_OPTION enumeration value.
OPC_E_DS_INVALID_SIGNATURE_COUNT
0x8051002B
A Signature part does not contain the signature markup for exactly one signature.
OPC_E_DS_INVALID_SIGNATURE_ORIGIN_RELATIONSHIP
0x8051001C
A package relationship of type digital signature origin is targeting a location that is external to the package. Digital Signature Origin parts must be located internally.
For more information about this relationship type, see the OPC.
OPC_E_DS_INVALID_SIGNATURE_XML
0x8051002A
The signature markup in a Signature part does not conform to the schema specified in the OPC or XML-Signature Syntax and Processing (https://go.microsoft.com/fwlink/p/?linkid=132847).
OPC_E_DS_MISSING_CANONICALIZATION_TRANSFORM
0x80510032
A relationships transform is not followed by a canonicalization method; the relationships transform must be followed by a canonicalization method.
OPC_E_DS_MISSING_CERTIFICATE_PART
0x80510056
The part that contains the certificate and is the target of a relationship of type digital signature certificate does not exist.
For more information about this relationship type, see the OPC.
OPC_E_DS_MISSING_PACKAGE_OBJECT_REFERENCE
0x8051002E
The signature markup is missing a Reference to the package-specific Object element.
OPC_E_DS_MISSING_SIGNATURE_ALGORITHM
0x8051002C
The signature markup does not specify a signature method algorithm.
OPC_E_DS_MISSING_SIGNATURE_ORIGIN_PART
0x8051001F
A relationship of type digital signature origin was found, but the Digital Signature Origin part itself was not.
For more information about this relationship type, see the OPC.
OPC_E_DS_MISSING_SIGNATURE_PART
0x80510020
The specified Signature part does not exist in the package.
OPC_E_DS_MISSING_SIGNATURE_PROPERTIES_ELEMENT
0x80510026
The SignatureProperties element was not found in the signature markup.
OPC_E_DS_MISSING_SIGNATURE_PROPERTY_ELEMENT
0x80510027
The SignatureProperty child element of the SignatureProperties element was not found.
OPC_E_DS_MISSING_SIGNATURE_TIME_PROPERTY
0x80510029
The SignatureProperty element with the Id attribute value of "idSignatureTime" does not exist or is not correctly constructed.
OPC_E_DS_MULTIPLE_RELATIONSHIP_TRANSFORMS
0x80510031
More than one relationships transform is specified for a Reference element, but only one relationships transform is allowed.
OPC_E_DS_PACKAGE_REFERENCE_URI_RESERVED
0x80510025
The reserved URI attribute value of the signature's Reference element to the package Object is being used as the URI attribute value of a Reference to a custom Object element.
OPC_E_DS_REFERENCE_MISSING_CONTENT_TYPE
0x80510030
The URI attribute value of a Reference element in the signature markup does not include the content type of the referenced part.
OPC_E_DS_SIGNATURE_CORRUPT
0x80510019
A signature in the package is not properly formed. Cannot get the signature value.
OPC_E_DS_SIGNATURE_METHOD_NOT_SET
0x80510046
The signature method has not been set. Call IOpcSigningOptions::SetSignatureMethod to set the signature method.
OPC_E_DS_SIGNATURE_ORIGIN_EXISTS
0x80510054
A Digital Signature Origin part already exists in the package and cannot be renamed.
OPC_E_DS_SIGNATURE_PROPERTY_MISSING_TARGET
0x80510045
The SignatureProperty element is missing the required Target attribute.
OPC_E_DS_SIGNATURE_REFERENCE_MISSING_URI
0x80510043
The URI attribute is required for a Reference element but is missing.
OPC_E_DS_UNSIGNED_PACKAGE
0x80510055
The package is not signed; therefore, the signature markup cannot be replaced.
OPC_E_DUPLICATE_DEFAULT_EXTENSION
0x8051000F
More than one Default element specifies the same extension in the content type XML markup.
For more information about Default elements and content type XML markup, see the OPC.
OPC_E_DUPLICATE_OVERRIDE_PART
0x8051000D
More than one Override element in the Content Types stream specifies the same part name as the value of its PartName attribute.
If this error is encountered while a package is being read, the package is not valid, because the PartName attribute value for each Override element must be unique.
For more information about Override elements, see the OPC.
OPC_E_DUPLICATE_PART
0x8051000B
A part with the specified part name already exists in the current package.
OPC_E_DUPLICATE_PIECE
0x80510015
A piece with the same piece number already exists in the current package.
Pieces are a result of interleaved parts. If the Packaging API is used to consume a package that supports interleaving, this error may result.
The Packaging API does not support the production of packages that have interleaved parts. For more information about interleaving, see the OPC.
OPC_E_DUPLICATE_RELATIONSHIP
0x80510013
A relationship with the same identifier already exists in the current package.
OPC_E_ENUM_CANNOT_MOVE_NEXT
0x80510051
The current position is already past the last item of the enumerator.
OPC_E_ENUM_CANNOT_MOVE_PREVIOUS
0x80510052
The current position already precedes the first item of the enumerator.
OPC_E_ENUM_COLLECTION_CHANGED
0x80510050
The enumerator is invalid because the underlying set has changed.
OPC_E_ENUM_INVALID_POSITION
0x80510053
The enumerator cannot perform this operation from its current position.
OPC_E_INVALID_CONTENT_TYPE
0x80510044
A content type does not conform to the rules for a valid media type, specified in RFC 2616: HTTP/1.1 (https://go.microsoft.com/fwlink/p/?linkid=143979) and the OPC.
OPC_E_INVALID_CONTENT_TYPE_XML
0x80510006
The XML markup that defines package content types in the Content Types stream is not well-formed.
OPC_E_INVALID_DEFAULT_EXTENSION
0x8051000E
An extension that is provided for a default content type is not valid, because it does not conform to the rules for a part name, specified in the OPC.
OPC_E_INVALID_OVERRIDE_PART_NAME
0x8051000C
The part name that is used as the value of the PartName attribute of an Override element in the Content Types stream does not conform to the rules for a valid part name, specified in RFC 3986: URI Generic Syntax (https://go.microsoft.com/fwlink/p/?linkid=143950) and the OPC.
For more information about Override elements, see the OPC.
OPC_E_INVALID_PIECE
0x80510016
An unexpected piece was found.
Pieces are a result of interleaved parts. If the Packaging API is used to consume a package that has interleaved parts, this error may result.
The Packaging API does not support the production of packages that have interleaved parts. For more information about interleaving, see the OPC.
OPC_E_INVALID_RELATIONSHIP_ID
0x80510010
The Id attribute of a relationship does not conform to the rules specified in the OPC.
OPC_E_INVALID_RELATIONSHIP_TARGET
0x80510012
The Target attribute of a relationship does not conform to the rules specified in the OPC.
OPC_E_INVALID_RELATIONSHIP_TARGET_MODE
0x8051004D
The TargetMode attribute of a relationship does not conform to the rules specified in the OPC.
OPC_E_INVALID_RELATIONSHIP_TYPE
0x80510011
The Type attribute of a relationship does not conform to the rules specified in the OPC.
OPC_E_INVALID_RELS_XML
0x8051000A
The relationship markup for a Relationships part is not well-formed XML.
OPC_E_INVALID_XML_ENCODING
0x80510042
The XML Encoding attribute must be UTF-8 or UTF-16.
OPC_E_MC_INCONSISTENT_PRESERVE_ATTRIBUTES
0x8051004B
The PreserveAttributes attribute does not have a matching Ignorable attribute on the same element.
OPC_E_MC_INCONSISTENT_PRESERVE_ELEMENTS
0x8051004C
The PreserveElements attribute does not have a matching Ignorable attribute on the same element.
OPC_E_MC_INCONSISTENT_PROCESS_CONTENT
0x8051004A
The ProcessContent attribute does not have a matching Ignorable attribute on the same element.
OPC_E_MC_INVALID_ATTRIBUTES_ON_IGNORABLE_ELEMENT
0x80510040
An element (or its parent) that is ignorable by markup compatibility has an attribute that is prohibited in Part 5: Markup Compatibility and Extensibility of ECMA-376 OpenXML (https://go.microsoft.com/fwlink/p/?linkid=123375).
OPC_E_MC_INVALID_ENUM_TYPE
0x8051003C
Encountered an enumeration type that is not valid.
OPC_E_MC_INVALID_PREFIX_LIST
0x80510037
The prefix list cannot be parsed, because it contains a character that is not valid, such as ':'.
OPC_E_MC_INVALID_QNAME_LIST
0x80510038
A markup compatibility attribute contains an invalid list of element names.
OPC_E_MC_INVALID_XMLNS_ATTRIBUTE
0x80510041
The declaration of an xmlns attribute is malformed.
OPC_E_MC_MISSING_CHOICE
0x8051003B
An AlternateContent element must have at least one Choice element as a child.
OPC_E_MC_MISSING_REQUIRES_ATTR
0x80510035
A markup compatibility element that requires the Requires attribute is missing the attribute, or that attribute's value is empty.
OPC_E_MC_MULTIPLE_FALLBACK_ELEMENTS
0x80510049
There is more than one Fallback element within the child elements of an AlternateContent, but only one is allowed.
OPC_E_MC_NESTED_ALTERNATE_CONTENT
0x80510039
An AlternateContent element cannot have another AlternateContent element as a child.
OPC_E_MC_UNEXPECTED_ATTR
0x80510036
A markup compatibility element has an attribute that is not recognized or supported in the markup compatibility namespace.
OPC_E_MC_UNEXPECTED_CHOICE
0x8051003A
A Choice element was encountered after the Fallback element, or more than one Fallback element was encountered.
OPC_E_MC_UNEXPECTED_ELEMENT
0x80510033
An element that is used in the markup compatibility namespace is not recognized as a valid markup compatibility element.
OPC_E_MC_UNEXPECTED_REQUIRES_ATTR
0x80510034
The Requires attribute was found on a markup compatibility element that does not support this attribute.
OPC_E_MC_UNKNOWN_NAMESPACE
0x8051003E
The MustUnderstand attribute of an element contains a namespace that is not recognized.
OPC_E_MC_UNKNOWN_PREFIX
0x8051003F
The package contains an XML prefix that is not defined.
OPC_E_MISSING_CONTENT_TYPES
0x80510007
Could not find the part that contains Content Types stream.
OPC_E_MISSING_PIECE
0x80510017
One or more pieces of an interleaved part were not found.
A piece is a file that contains data for an interleaved part. This error may result if the Packaging APIs are used to consume a package that has interleaved parts. Production of packages that have interleaved parts is not supported by the Packaging APIs. For more information about interleaving, see the OPC.
OPC_E_NO_SUCH_PART
0x80510018
The specified part does not exist.
OPC_E_NO_SUCH_RELATIONSHIP
0x80510048
The specified relationship does not exist.
OPC_E_NONCONFORMING_CONTENT_TYPES_XML
0x80510008
The Content Types stream XML markup does not conform to the syntax specified in RFC 2616: HTTP/1.1 and the OPC.
OPC_E_NONCONFORMING_RELS_XML
0x80510009
The relationship markup does not conform to the rules specified in the OPC.
OPC_E_NONCONFORMING_URI
0x80510001
The part name does not conform to the rules specified in the OPC.
OPC_E_PART_CANNOT_BE_DIRECTORY
0x80510004
The part name of one part is a segment in the path of the part name of another part. An example would be a part named "path/dirorfile/file.txt" and a part named "path/dirorfile".
OPC_E_RELATIONSHIP_URI_REQUIRED
0x80510003
The part name of a Relationships part is required, but the part name is not that of a Relationships part.
For more information about the part names of Relationships parts, see the OPC.
OPC_E_RELATIVE_URI_REQUIRED
0x80510002
A part name cannot be an absolute URI. An absolute URI begins with a schema component followed by a ":", as described in RFC 3986: URI Generic Syntax.
OPC_E_UNEXPECTED_CONTENT_TYPE
0x80510005
Either the content type of a part differed from the expected content type (specified in the OPC, ECMA-376 Part 2), or the part content did not match the part's content type.
OPC_E_UNSUPPORTED_PACKAGE
0x8051004F
The OPC allows certain aspects of a package, such as the number of pieces used to compose a part, to grow without bounds.
For practical purposes, however, the Packaging API limits the possible number of pieces to an unsigned DWORD.
OPC_E_ZIP_CENTRAL_DIRECTORY_TOO_LARGE
0x80511009
The central directory exceeds 65,535 bytes.
OPC_E_ZIP_COMMENT_TOO_LARGE
0x8051100C
The file comment length exceeds 65,535 bytes.
OPC_E_ZIP_COMPRESSION_FAILED
0x80511003
Compression of the data failed.
OPC_E_ZIP_CORRUPTED_ARCHIVE
0x80511002
The archive has an incorrect checksum or signature, or file headers in the central directory are in an unexpected order.
OPC_E_ZIP_DECOMPRESSION_FAILED
0x80511004
Data decompression failed.
OPC_E_ZIP_DUPLICATE_NAME
0x8051100B
Two file items in the archive have the same name.
OPC_E_ZIP_EXTRA_FIELDS_TOO_LARGE
0x8051100D
The extra field length exceeds 65,535 bytes.
OPC_E_ZIP_FILE_HEADER_TOO_LARGE
0x8051100E
The length of a local file header exceeds 65,535 bytes.
OPC_E_ZIP_INCONSISTENT_DIRECTORY
0x80511006
The number of file items found in the archive does not match the number of file items recorded in the central directory.
OPC_E_ZIP_INCONSISTENT_FILEITEM
0x80511005
The file attributes recorded in a file header in the central directory are inconsistent with the attributes of the zipped file item.
OPC_E_ZIP_INCORRECT_DATA_SIZE
0x80511001
A field or header in the archive contains a different number of bytes than expected.
OPC_E_ZIP_MISSING_DATA_DESCRIPTOR
0x80511007
A data descriptor was expected for the file item, but none was found.
OPC_E_ZIP_MISSING_END_OF_CENTRAL_DIRECTORY
0x8051100F
The archive is missing the end of the central directory record.
OPC_E_ZIP_NAME_TOO_LARGE
0x8051100A
The length of a file item name exceeds 65,535 characters.
OPC_E_ZIP_REQUIRES_64_BIT
0x80511010
The 64-bit ZIP format is required because the data exceeds the capacity of the 32-bit ZIP format. Recreate the package using the 64-bit ZIP format.
OPC_E_ZIP_UNSUPPORTEDARCHIVE
0x80511008
The package cannot be read because the archive is either unsupported (for example, a multidisk) or encrypted.

Remarks

For more information about error handling in COM, see Error Handling (COM).

The following table describes error prefixes used in the Packaging API.

Prefix Description Additional Information
OPC_E_ Generic Packaging error See the OPC.
OPC_E_DS_ Packaging digital signature error See section 12. Digital Signatures of the OPC and [XML Signature Syntax and Processing](https://go.microsoft.com/fwlink/p/?linkid=132847) (https://go.microsoft.com/fwlink/p/?linkid=132847) W3C recommendation.
OPC_E_ENUM_ Packaging enumerator error See the Packaging API enumerator interfaces in the following list.
[IOpcPartEnumerator](/previous-versions/windows/desktop/api/msopc/nn-msopc-iopcpartenumerator)
[IOpcRelationshipEnumerator](/previous-versions/windows/desktop/api/msopc/nn-msopc-iopcrelationshipenumerator)
[IOpcCertificateEnumerator](/previous-versions/windows/desktop/api/msopc/nn-msopc-iopccertificateenumerator)
[IOpcDigitalSignatureEnumerator](/previous-versions/windows/desktop/api/msopc/nn-msopc-iopcdigitalsignatureenumerator)
[IOpcRelationshipSelectorEnumerator](/previous-versions/windows/desktop/api/msopc/nn-msopc-iopcrelationshipselectorenumerator)
[IOpcSignatureCustomObjectEnumerator](/previous-versions/windows/desktop/api/msopc/nn-msopc-iopcsignaturecustomobjectenumerator)
[IOpcSignaturePartReferenceEnumerator](/previous-versions/windows/desktop/api/msopc/nn-msopc-iopcsignaturepartreferenceenumerator)
[IOpcSignatureReferenceEnumerator](/previous-versions/windows/desktop/api/msopc/nn-msopc-iopcsignaturereferenceenumerator)
[IOpcSignatureRelationshipReferenceEnumerator](/previous-versions/windows/desktop/api/msopc/nn-msopc-iopcsignaturerelationshipreferenceenumerator)
OPC_E_MC_ Packaging markup compatibility error See Part 5: Markup Compatibility and Extensibility of [ECMA-376 OpenXML](https://go.microsoft.com/fwlink/p/?linkid=123375) (https://go.microsoft.com/fwlink/p/?linkid=123375).
OPC_E_ZIP_ Packaging ZIP error See the [ZIP File Format Specification from PKWARE, Inc.]( https://go.microsoft.com/fwlink/p/?linkid=144545) (https://go.microsoft.com/fwlink/p/?linkid=144545).

Requirements

Header
Msopc.h

See also

Packaging API Reference

Overviews

Getting Started with the Packaging API

Packaging API Programming Guide

Reference

Package Consumption Error Group

Packaging Enumerations

Packaging API Samples

Part URI Error Group

External Resources

ECMA-376 OpenXML standard

RFC 2616: HTTP/1.1

RFC 3986: URI Generic Syntax

W3C Recommendation, XML-Signature Syntax and Processing

ZIP File Format Specification from PKWARE, Inc., version 6.2.0 (2004)