本文整理汇总了C#中EmailAddress类的典型用法代码示例。如果您正苦于以下问题:C# EmailAddress类的具体用法?C# EmailAddress怎么用?C# EmailAddress使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EmailAddress类属于命名空间,在下文中一共展示了EmailAddress类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateNewMeeting
public async Task CreateNewMeeting()
{
try
{
Microsoft.Graph.Event evt = new Microsoft.Graph.Event();
Location location = new Location();
location.DisplayName = tbLocation.Text;
ItemBody body = new ItemBody();
body.Content = tbBody.Text;
body.ContentType = BodyType.Html;
List<Attendee> attendees = new List<Attendee>();
Attendee attendee = new Attendee();
EmailAddress email = new EmailAddress();
email.Address = tbToRecipients.Text;
attendee.EmailAddress = email;
attendee.Type = AttendeeType.Required;
attendees.Add(attendee);
evt.Subject = tbSubject.Text;
evt.Body = body;
evt.Location = location;
evt.Attendees = attendees;
DateTimeTimeZone dtStart = new DateTimeTimeZone();
dtStart.TimeZone = TimeZoneInfo.Local.Id;
DateTime dts = dtpStartDate.Value.Date + dtpStartTime.Value.TimeOfDay;
dtStart.DateTime = dts.ToString();
DateTimeTimeZone dtEnd = new DateTimeTimeZone();
dtEnd.TimeZone = TimeZoneInfo.Local.Id;
DateTime dte = dtpEndDate.Value.Date + dtpEndTime.Value.TimeOfDay;
dtEnd.DateTime = dte.ToString();
evt.Start = dtStart;
evt.End = dtEnd;
// log the request info
sdklogger.Log(graphClient.Me.Events.Request().GetHttpRequestMessage().Headers.ToString());
sdklogger.Log(graphClient.Me.Events.Request().GetHttpRequestMessage().RequestUri.ToString());
// send the new message
var createdEvent = await graphClient.Me.Events.Request().AddAsync(evt);
// log the send and associated id
sdklogger.Log("Meeting Sent : Id = " + createdEvent.Id);
}
catch (Exception ex)
{
sdklogger.Log("NewMeetingSend Failed: " + ex.Message);
sdklogger.Log(ex.Message);
}
finally
{
// close the form
Close();
}
}
示例2: EmailAddress_TwoAddressesDifferentValue_AreNotEqual
public void EmailAddress_TwoAddressesDifferentValue_AreNotEqual()
{
var address = new EmailAddress("[email protected]", "test");
var address2 = new EmailAddress("[email protected]", "test");
Assert.IsTrue(address != address2);
}
示例3: CheckAccess
/// <summary>
/// Checks the access an account has with an organization..
/// </summary>
/// <param name="name">The organization name.</param>
/// <param name="accountId">The account identifier.</param>
/// <param name="allowAdmin">if set to <c>true</c> allow admin.</param>
/// <param name="allowWrite">if set to <c>true</c> allow write.</param>
/// <param name="allowRead">if set to <c>true</c> allow read.</param>
public void CheckAccess(
DomainLabel name,
EmailAddress accountId,
out bool allowAdmin,
out bool allowWrite,
out bool allowRead)
{
allowAdmin = false;
allowWrite = false;
allowRead = false;
if (name == null)
{
throw new ArgumentNullException("name");
}
if (accountId == null)
{
throw new ArgumentNullException("accountId");
}
CloudTable orgMemberTable = this.GetOrganizationMembershipTable();
TableOperation getOrgMember = TableOperation.Retrieve<OrganizationMembershipEntity>(
name.ToString(),
accountId.ToString());
TableResult result = orgMemberTable.Execute(getOrgMember);
OrganizationMembershipEntity entity = result.Result as OrganizationMembershipEntity;
if (entity != null)
{
allowRead = true;
allowWrite = entity.AllowWrite;
allowAdmin = entity.AllowAdmin;
}
}
示例4: EmailAddress_TwoAddressesSameValue_AreEqual
public void EmailAddress_TwoAddressesSameValue_AreEqual()
{
var address = new EmailAddress("[email protected]", "test");
var address2 = new EmailAddress("[email protected]", "test");
Assert.IsTrue(address == address2);
}
示例5: ActivateAccount
/// <summary>
/// Activates the given account if it is not already activated.
/// </summary>
/// <param name="accountId">the account to activate.</param>
public void ActivateAccount(
EmailAddress accountId)
{
CloudTable loginTable = this.GetLoginTable();
CloudTable accountTable = this.GetAccountTable();
LoginEntity existingEntity = FindExistingLogin(loginTable, accountId);
AccountEntity existingAccount = FindExistingAccount(accountTable, accountId);
if (existingEntity == null || existingAccount == null)
{
throw new InvalidOperationException("Account does not exist.");
}
if (existingEntity.Activated)
{
return;
}
existingAccount.ActivatedTime = DateTime.UtcNow;
existingEntity.Activated = true;
TableOperation updateAccountOperation = TableOperation.Replace(existingAccount);
accountTable.Execute(updateAccountOperation);
TableOperation updateLoginOperation = TableOperation.Replace(existingEntity);
loginTable.Execute(updateLoginOperation);
}
示例6: Create
public ActionResult Create(EmailAddress Model)
{
return Dispatcher.Create(
DataModel: Model,
SuccessResult: m => ModalRedirectToLocal(Url.Action("Index", "Settings", new { Area = "Account" }, null)),
InvalidResult: m => PartialView(m));
}
示例7: Equals_SameAddressAndNullTypes_AreEqual
public void Equals_SameAddressAndNullTypes_AreEqual()
{
var emailAddress1 = new EmailAddress("[email protected]", null);
var emailAddress2 = new EmailAddress("[email protected]", null);
Assert.Equal(emailAddress1, emailAddress2);
}
示例8: Equals_SameAddressAndSameTypes_AreEqual
public void Equals_SameAddressAndSameTypes_AreEqual()
{
var emailAddress1 = new EmailAddress("[email protected]", EmailAddressType.Personal);
var emailAddress2 = new EmailAddress("[email protected]", EmailAddressType.Personal);
Assert.Equal(emailAddress1, emailAddress2);
}
示例9: AccountRegistration
public AccountRegistration(Username username, Password password, FullName fullName, EmailAddress email)
{
Email = email;
Username = username;
Password = password;
FullName = fullName;
}
示例10: Equals_DifferentAddressesAndNullTypes_AreNotEqual
public void Equals_DifferentAddressesAndNullTypes_AreNotEqual()
{
var emailAddress1 = new EmailAddress("[email protected]", null);
var emailAddress2 = new EmailAddress("[email protected]", null);
Assert.NotEqual(emailAddress1, emailAddress2);
}
示例11: Equals_SameAddressAndOneNullType_AreNotEqual
public void Equals_SameAddressAndOneNullType_AreNotEqual()
{
var emailAddress1 = new EmailAddress("[email protected]", null);
var emailAddress2 = new EmailAddress("[email protected]", EmailAddressType.Work);
Assert.NotEqual(emailAddress1, emailAddress2);
}
示例12: Equals_SameAddressAndDifferentTypes_AreNotEqual
public void Equals_SameAddressAndDifferentTypes_AreNotEqual()
{
var emailAddress1 = new EmailAddress("[email protected]", EmailAddressType.Personal);
var emailAddress2 = new EmailAddress("[email protected]", EmailAddressType.Work);
Assert.NotEqual(emailAddress1, emailAddress2);
}
示例13: EqualsOperator
public void EqualsOperator()
{
var email1 = new EmailAddress("[email protected]");
var email2 = new EmailAddress("[email protected]");
Assert.True(email1 == email2);
}
示例14: ComposeRepairCompletedEmailMessage
public async Task<Message> ComposeRepairCompletedEmailMessage(int incidentId)
{
var incident = await GetIncident(incidentId);
var attachments = await GetInspectionOrRepairPhotosAsAttachments("Room Inspection Photos", incident.sl_inspectionID.Id, incident.sl_roomID.Id);
var property = incident.sl_propertyID;
var propertyOwnerRecipientEmail = new EmailAddress { Address = property.sl_emailaddress, Name = property.sl_owner };
var dispacherRecipientEmail = new EmailAddress { Address = DispatcherEmail, Name = DispatcherName };
var bodyTemplate = System.IO.File.ReadAllText(bodyTemplateFile);
var viewBag = new RazorEngine.Templating.DynamicViewBag();
viewBag.AddValue("InspectionPhotosAttachments", attachments);
var body = RazorEngine.Razor.Parse(bodyTemplate, incident, viewBag, "EmailBody");
var message = new Message
{
Subject = string.Format("Repair Report - {0} - {1:MM/dd/yyyy}", property.Title, DateTime.UtcNow),
Importance = Importance.Normal,
Body = new ItemBody
{
ContentType = BodyType.HTML,
Content = body
},
};
message.ToRecipients.Add(new Recipient { EmailAddress = propertyOwnerRecipientEmail });
message.CcRecipients.Add(new Recipient { EmailAddress = dispacherRecipientEmail });
foreach (var attachment in attachments)
message.Attachments.Add(attachment);
return message;
}
示例15: CreateSystemAccount
/// <summary>
/// Creates the system account.
/// </summary>
/// <param name="identifier">The identifier.</param>
/// <param name="displayName">The display name.</param>
/// <param name="emailAddress">The email address.</param>
/// <param name="identityProviderName">Name of the identity provider.</param>
/// <param name="identityProviderUri">The identity provider URI.</param>
/// <returns>
/// A SystemAccount.
/// </returns>
public SystemAccount CreateSystemAccount(string identifier, string displayName, EmailAddress emailAddress, string identityProviderName, string identityProviderUri )
{
var account = new SystemAccount ( identifier, displayName, emailAddress, identityProviderName, identityProviderUri );
_repository.MakePersistent ( account );
return account;
}