Thursday, October 31, 2013

Can't create a mailitem under outlook2010 and win8

Hi, all



Microsoft.Office.Interop.Outlook.MailItem olkMail1 =
(olkApp1.CreateItem(Outlook.OlItemType.olMailItem)) as Outlook.MailItem;
olkMail1.To = @"dd";
olkMail1.CC = "";
olkMail1.Subject = "Assignment note";
olkMail1.Body = "Assignment note";

//Automate the Outlook mail item.
Outlook.Accounts accounts = olkApp1.Session.Accounts;
foreach (Outlook.Account temp in accounts)
{
if (temp.SmtpAddress == "frank@hello.com")
MessageBox.Show("hello");
}



In this code block, the createitem method always return null, after google, some users say it might be the user access control(UAC) problem. Is there any way to solve this problem by code instead of change UAC?






Every answer may help a lot, thanks guys

Frank


No comments:

Post a Comment