In my previous blog post mentioned the SharePoint call outgoing mail server and e-mail address to send mail
However, the methods which can only be used to send regular e-mail. If you want to launch a special meeting of the class of mail, you can use Outlook's own API.
Create a project, it added. NET Reference: "Microsoft.Office.Interop.Outlook" reference, you can call, to note that, in added time, take note OFFICE version.
Initiated the call to the API during the meeting, ran into a problem:
An appointment after you create the entry, looking for a long time for this appointment can not find how to specify the "From", then one would like, Window CF, find personnel information have OutlookSession of the East,
Well, this Outlook will not do the same way, tested, really have to find ways, the original, its API is specified by the sender and your machine running Outlook account settings directly related.
By ApplicationClass.Session.Accounts can find your account settings set, require special special attention is here to take a staff, set the index is a beginning, not
Starting at 0. Find the relevant account, you can AppointmentItem.SendUsingAccount attribute to specify the date of the sender.
--- However, if I Bu Shi Yong Outlook account set in Account Settings, and to specify other's Youjian account to send mail from the get how? And it has not 鎵惧埌 Huo Fa Xian way, Xi Wang Ren Men can know the up
Gets advice channels, Bese first ~ ~ ~ ~
The following is test code, running in WIN2003 + OFFICE12 through, successfully created the meeting:
1using System;
2using System.Collections.Generic;
3using System.Text;
4using Microsoft.Office.Interop.Outlook;
5 ////////////////////
6 / * launch meeting called Outlook api
7 / * mcjeremy@cnblogs.com
8 ////////////////////
9namespace OutlookAPI
10 (
11 class Program
12 (
13 static void Main (string [] args)
14 (
15 try
16 (
17 ApplicationClass oApp = new Microsoft.Office.Interop.Outlook.ApplicationClass ();
18
19 / / meeting is an appointment
20 AppointmentItem oItem = (AppointmentItem) oApp.CreateItem (OlItemType.olAppointmentItem);
21 oItem.MeetingStatus = OlMeetingStatus.olMeeting;
22
23 oItem.Subject = "topic";
24
25 oItem.Body = "content";
26
27 oItem.Location = "place";
28
29 / / start time
30 oItem.Start = DateTime.Now.AddDays (1);
31
32 / / end time
33 oItem.End = DateTime.Now.AddDays (2);
34
35 / / alert settings
36 oItem.ReminderSet = true;
37 oItem.ReminderMinutesBeforeStart = 5;
38
39 / / if all-day event
40 oItem.AllDayEvent = false;
41
42 oItem.BusyStatus = OlBusyStatus.olBusy;
43
44 / / index starts with 1 instead of 0
45 / / sender's account information
46 oItem.SendUsingAccount = oApp.Session.Accounts [2];
47
48 / / Add the necessary selection
49 Recipient force = oItem.Recipients.Add ("mailuser2@mailserver.com");
50 force.Type = (int) OlMeetingRecipientType.olRequired;
51 / / Add optional person
52 Recipient opt = oItem.Recipients.Add ("mailuser3@p.mailserver.com");
53 opt.Type = (int) OlMeetingRecipientType.olOptional;
54 / / Add the meeting initiator
55 Recipient sender = oItem.Recipients.Add ("mailuser1@mailserver.com");
56 sender.Type = (int) OlMeetingRecipientType.olOrganizer;
57
58 oItem.Recipients.ResolveAll ();
59
60 / / oItem.SaveAs ("d: / TEST.MSG", OlSaveAsType.olMSG);
61
62 oItem.Send ();
63
64 / / MailItem mItem = (MailItem) oApp.CreateItem (OlItemType.olMailItem);
65 / / Recipient rTo = mItem.Recipients.Add ("****");
66 / / rTo.Type = (int) OlMailRecipientType.olTo;
67 / / Recipient rCC = mItem.Recipients.Add ("****");
68 / / rCC.Type = (int) OlMailRecipientType.olCC;
69 / / Recipient rBC = mItem.Recipients.Add ("****");
70 / / rBC.Type = (int) OlMailRecipientType.olBCC;
71
72 Console.WriteLine ("OK");
73)
74 catch (System.Exception ex)
75 (
76 Console.WriteLine (ex.Message);
77)
78
79 Console.ReadLine ();
80)
81)
82)
83
相关链接:
Expert Project Management
WorldCup PDA Converter
Youtube to Flash Guide
Happiness CDA OGG MP3 To VQF Copier
Flv To Mpeg Converter Free
video converter
Video Format For Blackberry
AllRipper Flash to Mobile
Wizard Personal Interest
LasVegas MPEG To IPod
Bliss CD-R M4A RA to DVD-Audio Manager
Convert Avi To Wmv Free Download
MP2 MPC Recorder
Ever CDA APE M4A to Sound Recorder
ALO Audio CENTER
No comments:
Post a Comment