Sunday, 15 March 2015

How to avoid Outlook security alert when sending outlook appointment from C# program -



How to avoid Outlook security alert when sending outlook appointment from C# program -

wrote function in order send appointment via microsoft outlook. method works before sending appointment, outlook security alert pops out , inquire if allow/deny access. this code:

class="lang-cs prettyprint-override">public static void sendappointment() { outlook.application oapp = new outlook.application(); outlook.appointmentitem oappointment = oapp.createitem(outlook.olitemtype.olappointmentitem); oappointment.subject = "subject"; oappointment.body = "body"; oappointment.location = "some location"; oappointment.start = datetime.now; oappointment.end = datetime.now.adddays(1); oappointment.importance = outlook.olimportance.olimportancenormal; oappointment.meetingstatus = outlook.olmeetingstatus.olmeeting; outlook.recipient orecip = oappointment.recipients.add("sample@gmail.com"); orecip.resolve(); // not sure if line necessary oappointment.send(); }

i saw somewhere prepare not build new application existing using line:

outlook.mailitem tempitem = globals.thisaddin.application.createitem(outlook.olitemtype.olmailitem);

but not found assembly globals class is.

c#

No comments:

Post a Comment