我有一个具有O365身份验证的webforms网站,我在构建项目时使用可视工作室内置选项添加了身份验证.
这很好用,但我想做的是,它获取用户登录的电子邮件地址,并根据登录的人显示不同的链接集或不同的页面.
我该怎么做呢?
我有一个邮箱,每 5 分钟从远程站收到一封自动电子邮件。该电子邮件中包含一个字符串,需要与前一封电子邮件中的相同字符串进行比较。
出于显而易见的原因,我正在尝试自动化此过程。
到目前为止,我能够阅读ConversationTopic电子邮件,但是,我似乎无法弄清楚如何阅读电子邮件的内容。
当它调用这个时:
email.Load();
MessageBox.Show(email.TextBody.Text.ToString());
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
You must load or assign this property before you can read its value
我有一个谷歌,我找不到任何与我的实例相关的东西,所以任何帮助都会很棒。
到目前为止,这是我的完整代码:
private void Form1_Load(object sender, EventArgs e)
{
try
{
//MessageBox.Show("Registering Exchange connection");
_service = new ExchangeService
{
Credentials = new WebCredentials("myaddy@domain.com", "*****")
};
}
catch
{
MessageBox.Show("new ExchangeService failed.");
return;
}
// This is the office365 webservice URL
_service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
// Prepare seperate class for writing email to the database
try
{ …Run Code Online (Sandbox Code Playgroud)