編輯

共用方式為


MailEnvelope2.Available Property

Definition

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 Outlook 2010, 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 Outlook 2010. If a form is sent as an e-mail attachment to a user running Microsoft Outlook 2010, 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.

Applies to