Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[AttachURLW is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.]
Attaches the contents of a URL to the message and creates an MSHTML message. Usually, the attached URL is referenced by another body in the message.
Syntax
HRESULT AttachURLW(
[in] LPCSTR pszBase,
[in] LPCSTR pszURL,
[in] DWORD dwFlags,
[in] IStream *pstmURL,
[out] LPWSTR *ppwszCIDURL,
[out] LPHBODY phBody
);
Parameters
-
pszBase [in]
-
Type: LPCSTR
Specifies together with pszURL a valid URL. pszBase specifies the base URL and pszURL specifies the relative URL.
-
pszURL [in]
-
Type: LPCSTR
Specifies together with pszBase a valid URL. pszBase specifies the base URL and pszURL specifies the relative URL. When pstmURL is NULL, pszURL must specify a valid resource that MimeOLE has read access to.
-
dwFlags [in]
-
Type: DWORD
Specifies a bitmask that affects the behavior of this method.
Value Meaning - URL_ATTACH_INTO_MIXED
- 0x00000001
Indicates that the body must be created in the multipart/mixed section of the message. - URL_ATTACH_GENERATE_CID
- 0x00000002
Indicates that the Content-ID must be generated and stored on the new body. - URL_ATTACH_SET_CNTTYPE
- 0x00000004
Indicates that the Content-Type must be derived from the URL and stored on the new body. -
pstmURL [in]
-
Type: IStream*
Specifies a pointer to an IStream object that contains the data for the URL. MimeOLE increments the reference count for this object and does not release it until the whole message object is freed or until HandsOffStorage is called.
-
ppwszCIDURL [out]
-
Type: LPWSTR*
Receives a pointer to the generated Content-ID string when dwFlags is specified as URL_ATTACH_GENERATE_CID. The client is responsible for freeing this pointer by calling IMalloc::Free.
-
phBody [out]
-
Type: LPHBODY
Receives the handle of the new body.
Return value
Type: HRESULT
Returns one of the following values.
| Return code | Description |
|---|---|
|
Indicates success. |
|
Indicates that an unknown error has occurred. |
|
Indicates an attempt to allocate memory failed. |
Remarks
The contents of a URL can be retrieved in two ways.
- A client passes the contents of the URL into this method in the pstmURL parameter.
- A client specifies a valid URL in the pszBase and pszURL parameters. Then, when the message is saved or when a client requests the data for the body, MimeOLE downloads the content.
Data in the object that pstmURL points to or the resource specified by pszBase and pszURL must be stored in either IET_BINARY or IET_DECODED type. For more information, see ENCODINGTYPE.
When URL_ATTACH_INTO_MIXED is specified in the dwFlags parameter, this method creates the new body in the multipart/mixed section of the message. If a multipart/mixed section does not exist, one is created. Otherwise, this method creates the new body in the multipart/related section of the message. If a multipart/related section does not exist, one is created.
When a client sets pszBase and pszURL to NULL and specifies the URL_ATTACH_GENERATE_CID flag in the dwFlags parameter, MimeOLE generates and sets the PID_HDR_CNTID property of the new body. The client can receive a pointer to the generated Content-ID from the ppwszCIDURL parameter.
When a client specifies a valid URL in pszURL but does not specify URL_ATTACH_GENERATE_CID in the dwFlags, MimeOLE sets the PID_HDR_CNTLOC property for the new body.
When a client specifies a valid URL in pszURL and specifies URL_ATTACH_SET_CNTTYPE in the dwFlags, MimeOLE sets the PID_HDR_CNTTYPE property for the new body. And when a client specifies a valid base URL in pszBase, MimeOLE sets the PIDR_HDR_CNTBASE property for the new body to pszBase.
To display an image inline with the body text of a message, a client can pass in the URL of the image and then reference the Content-ID string returned in ppwszCIDURL in HTML.
Requirements
| Minimum supported client |
Windows XP [desktop apps only] |
| Minimum supported server |
Windows Server 2003 [desktop apps only] |
| Product |
Outlook Express 6.0 |
| Header |
|
| IDL |
|
| DLL |
|