MailEnvelope2.Available Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets whether the other properties of the MailEnvelope2 object are available to code running in the form.
public:
property bool Available { bool get(); };
public bool Available { get; }
member this.Available : bool
Public ReadOnly Property Available As Boolean
Property Value
true if the other properties of the MailEnvelope2 object are available to code running in the form; otherwise false.
Examples
The following example sets a reference to the MailEnvelopeObject object, uses the Available property to determine if the form is open Microsoft Office Outlook 2007, and if so, in sets envelope properties, and then displays the e-mail envelope.
// Set a reference to the MailEnvelope2 object.
MailEnvelope2 myEnv =
(MailEnvelope2)thisApplication.ActiveWindow.MailEnvelope;
if (myEnv.<span class="label">Available)</span>
{
// Specify addresses and subject.
myEnv.To = "someone@example.com";
myEnv.CC = "someone@example.com";
myEnv.BCC = "someone@example.com";
myEnv.Subject = "Open this form";
// Display form with e-mail envelope.
myEnv.Visible = true;
}
else
{
// The form is open in Outlook, and code will not run.
thisXDocument.UI.Alert("This form is open in Outlook.");
}
Remarks
The Available property is use to test whether the form is open in Microsoft Office Outlook 2007. If a form is sent as an e-mail attachment to a user running Microsoft Office Outlook 2007, the form will open within Outlook. In this context, it is not appropriate to programmatically create an e-mail message for attaching and sending the currently open InfoPath form because the form and e-mail message to which it is attached are already open in Outlook, and the Available property will return false. If the form is opened in InfoPath, the Available property will return true and form code can use the properties of the MailEnvelope2 object.
Because the Available property is new to Microsoft InfoPath, you must declare and cast to the MailEnvelope2 type to access this method. For more information, see How to: Use Object Model Members That Are Not Compatible with InfoPath 2003.
This member can be accessed without restrictions.