Outlook meeting room

Source: Internet
Author: User
Original article: Outlook meeting room

However, the method can only be used to send normal emails. If you want to initiate special emails such as meetings, you can use C # To Call The outlook API and its own API.

After creating a project, add it. net reference: "Microsoft. office. interOP. outlook "reference, you can call it, note that when adding, pay attention to the office version number.

C # encountered a problem when calling the outlook API to initiate a meeting:

After creating an appointment, I have not found how to specify a sender for this appointment for a long time. Later I thought that in window CF, The lookup personnel information had an outlooksession,

Will outlook be in the same way? After testing, I found the method. Originally, the sender specified by its API was directly related to the account settings of outlook running on your machine.

You can use applicationclass. session. Accounts to find the set of accounts you set. Note that the index of the set starts from 1 when a person is retrieved.

Starts from 0. After finding the relevant account, you can use the appointmentitem. sendusingaccount attribute to specify the sender of the appointment. However, if I do not use the account set in outlook, but want to specify other email accounts to send emails, what should I do? No way has been found or found up till now, and people who want to know can

Give me some advice and thank you ~~~~

The test code is as follows:

  1. Using system;
  2. Using system. Collections. Generic;
  3. Using system. text;
  4. Using Microsoft. Office. InterOP. outlook;
  5. ////////////////////
  6. /* Call the outlook API to initiate a meeting
  7. /* [Email protected]
  8. ////////////////////
  9. Namespace outlookapi
  10. {
  11. Class Program
  12. {
  13. Static void main (string [] ARGs)
  14. {
  15. Try
  16. {
  17. Applicationclass oapp =
  18. New Microsoft. Office. InterOP. Outlook. applicationclass ();
  19.  
  20. // Meeting is a type of appointment.
  21. Appointmentitem oitem = (appointmentitem) oapp. createitem (
  22. Olitemtype. olappointmentitem );
  23. Oitem. meetingstatus = olmeetingstatus. olmeeting;
  24.  
  25. Oitem. Subject = "topic ";
  26.  
  27. Oitem. Body = "content ";
  28.  
  29. Oitem. Location = "location ";
  30.  
  31. // Start time
  32. Oitem. Start = datetime. Now. adddays (1 );
  33.  
  34. // End Time
  35. Oitem. End = datetime. Now. adddays (2 );
  36.  
  37. // Reminder settings
  38. Oitem. reminderset = true;
  39. Oitem. reminderminutesbeforestart = 5;
  40.  
  41. // Whether it is a full-day event
  42. Oitem. alldayevent = false;
  43.  
  44. Oitem. busystatus = olbusystatus. olbusy;
  45.  
  46. // Index starts from 1 instead of 0
  47. // Sender's account information
  48. Oitem. sendusingaccount = oapp. session. Accounts [2];
  49.  
  50. // Add a required person
  51. Recipient force = oitem. Recipients. Add ("[email protected]");
  52. Force. type = (INT) olmeetingrecipienttype. olrequired;
  53. // Add optional persons
  54. Recipient opt = oitem. Recipients. Add ("[email protected]");
  55. Opt. type = (INT) olmeetingrecipienttype. oloptional;
  56. // Add the meeting Initiator
  57. Recipient sender = oitem. Recipients. Add ("[email protected]");
  58. Sender. type = (INT) olmeetingrecipienttype. olorganizer;
  59.  
  60. Oitem. Recipients. resolveall ();
  61.  
  62. // Oitem. saveas ("D:/test. MSG", olsaveastype. olmsg );
  63.  
  64. Oitem. Send ();
  65.  
  66. // Mailitem mitem = (mailitem) oapp. createitem (olitemtype. olmailitem );
  67. // Recipient RTO = mitem. Recipients. Add ("****");
  68. // RTO. type = (INT) olmailrecipienttype. olto;
  69. // Recipient RCC = mitem. Recipients. Add ("****");
  70. // RCC. type = (INT) olmailrecipienttype. OLCC;
  71. // Recipient rb= mitem. Recipients. Add ("****");
  72. // RBC. type = (INT) olmailrecipienttype. olbcc;
  73.  
  74. Console. writeline ("OK ");
  75. }
  76. Catch (system. Exception ex)
  77. {
  78. Console. writeline (ex. Message );
  79. }
  80.  
  81. Console. Readline ();
  82. }
  83. }
  84. }

The preceding section describes how to call the outlook API in C.

Outlook meeting room

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.