IOpcFactory::CreatePartUri method (msopc.h)

Creates a part URI object that represents a part name.

Syntax

HRESULT CreatePartUri(
  [in]          LPCWSTR     pwzUri,
  [out, retval] IOpcPartUri **partUri
);

Parameters

[in] pwzUri

A URI that represents the location of a part relative to the root of the package that contains it.

[out, retval] partUri

A pointer to the IOpcPartUri interface of the part URI object. This object represents the part name derived from the URI passed in pwzUri.

Part names must conform to the syntax specified in the OPC.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code/value Description
S_OK
The method succeeded.
E_POINTER
At least one of the pwzUri and partUri parameters is NULL.
OPC_E_NONCONFORMING_URI
0x80510001
A part name cannot be the empty string "".
OPC_E_NONCONFORMING_URI
0x80510001
A part name cannot be a '/'.
OPC_E_NONCONFORMING_URI
0x80510001
A part name cannot begin with "//".
OPC_E_NONCONFORMING_URI
0x80510001
A part name cannot end with a '/'.
OPC_E_NONCONFORMING_URI
0x80510001
A part name cannot end with a '.'.
OPC_E_NONCONFORMING_URI
0x80510001
A part name cannot have any segments that end with a '.'.
OPC_E_NONCONFORMING_URI
0x80510001
A part name cannot have fragment component. A fragment component is preceded by a '#' character, as described in RFC 3986: URI Generic Syntax.
OPC_E_NONCONFORMING_URI
0x80510001
A part name cannot be the name of a Relationships part that indicates another Relationships part as the source of the relationships contained therein.
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.
CreateUri function error
An HRESULT error code from the CreateUri function.
WinINet error
An HRESULT error code from a WinINet API.

Remarks

Support on Previous Windows Versions

The behavior and performance of this method is the same on all supported Windows versions. For more information, see Getting Started with the Packaging API, and Platform Update for Windows Vista.

Thread Safety

Packaging objects are not thread-safe.

For more information, see the Getting Started with the Packaging API.

Requirements

Requirement Value
Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps only]
Target Platform Windows
Header msopc.h

See also

CreateUri

ECMA-376 OpenXML

External Resources

Getting Started with the Packaging API

IOpcFactory

Overviews

Packaging API Programming Guide

Packaging API Reference

Packaging API Samples

Packaging Errors

Parts Overview

Platform Update for Windows Vista

RFC 3986: URI Generic Syntax

Reference