PersonalStorage.CreateAsync
Contents
[
Hide
]CreateAsync(string, FileFormatVersion, CancellationToken)
Asynchronously creates a new PST file.
public static Task<PersonalStorage> CreateAsync(string fileName, FileFormatVersion version,
CancellationToken token = default)
| Parameter | Type | Description |
|---|---|---|
| fileName | String | The path of the file to create. The file must not exist. |
| version | FileFormatVersion | The version of the PST. Only FileFormatVersion.Unicode is supported. |
| token | CancellationToken | A token to cancel the operation. |
Return Value
A task whose result is the new PST, open for writing.
Exceptions
| exception | condition |
|---|---|
| NotImplementedException | version is FileFormatVersion.ANSI. |
| ArgumentNullException | fileName is null or empty. |
| IOException | A file named fileName already exists. |
Remarks
Only Unicode PST files can be created.
See Also
- enum FileFormatVersion
- class PersonalStorage
- namespace Aspose.Email.Storage.Pst
- assembly Aspose.Email
CreateAsync(Stream, FileFormatVersion, CancellationToken)
Asynchronously creates a new PST in a stream.
public static Task<PersonalStorage> CreateAsync(Stream stream, FileFormatVersion version,
CancellationToken token = default)
| Parameter | Type | Description |
|---|---|---|
| stream | Stream | The stream to write the PST to. |
| version | FileFormatVersion | The version of the PST. Only FileFormatVersion.Unicode is supported. |
| token | CancellationToken | A token to cancel the operation. |
Return Value
A task whose result is the new PST, open for writing.
Exceptions
| exception | condition |
|---|---|
| NotImplementedException | version is FileFormatVersion.ANSI. |
| ArgumentNullException | stream is null. |
Remarks
Only Unicode PST files can be created. The stream is closed when the storage is disposed. Use the overload with leaveStreamOpen to keep it open.
See Also
- enum FileFormatVersion
- class PersonalStorage
- namespace Aspose.Email.Storage.Pst
- assembly Aspose.Email
CreateAsync(Stream, FileFormatVersion, bool, CancellationToken)
Asynchronously creates a new PST in a stream.
public static Task<PersonalStorage> CreateAsync(Stream stream, FileFormatVersion version,
bool leaveStreamOpen, CancellationToken token = default)
| Parameter | Type | Description |
|---|---|---|
| stream | Stream | The stream to write the PST to. |
| version | FileFormatVersion | The version of the PST. Only FileFormatVersion.Unicode is supported. |
| leaveStreamOpen | Boolean | true to leave stream open when the storage is disposed. |
| token | CancellationToken | A token to cancel the operation. |
Return Value
A task whose result is the new PST, open for writing.
Exceptions
| exception | condition |
|---|---|
| NotImplementedException | version is FileFormatVersion.ANSI. |
| ArgumentNullException | stream is null. |
Remarks
Only Unicode PST files can be created.
See Also
- enum FileFormatVersion
- class PersonalStorage
- namespace Aspose.Email.Storage.Pst
- assembly Aspose.Email