MapiContact.Load

Load(string)

Loads a MapiContact from the specified file.

public static MapiContact Load(string filePath)
ParameterTypeDescription
filePathStringThe path to the file to be loaded.

Return Value

Returns a MapiContact instance loaded from the specified file.

Exceptions

exceptioncondition
ArgumentExceptionfilePath is null or empty.
FileNotFoundExceptionThe specified file does not exist.
InvalidOperationExceptionThe file holds neither a contact item nor a vCard.

Remarks

Accepts both formats Save can produce: an Outlook MSG file holding a contact item, and a vCard file (read as FromVCard would). This makes MapiContact.Load(path) the inverse of contact.Save(path), which writes vCard by default.

See Also


Load(Stream)

Loads a MapiContact from the specified stream.

public static MapiContact Load(Stream stream)
ParameterTypeDescription
streamStreamThe stream to be loaded.

Return Value

Returns a MapiContact instance loaded from the specified stream.

Exceptions

exceptioncondition
ArgumentNullExceptionstream is null.
NotSupportedExceptionstream does not support reading.
InvalidOperationExceptionThe stream holds neither a contact item nor a vCard.

Remarks

Accepts both formats Save can produce: an Outlook MSG file holding a contact item, and a vCard file (read as FromVCard would). This makes MapiContact.Load(path) the inverse of contact.Save(path), which writes vCard by default.

The stream is read from its beginning, whatever its current position.

See Also