2

ファイルを作成することは可能でしょうか。受信者の電子メール アドレスが事前に入力されている新しい会議の Ics? これらのメール アドレスを引数として送信することはできますか? それとも、それは単に不可能ですか?

このような :

ここに画像の説明を入力

非常にうまく機能するために使用される私のコードは次のとおりです。

    public string subject = string.Empty;
    public string body = string.Empty;
    public string uid = string.Empty;
    public DateTime date ;
    public Random rand;

    protected void Page_Load(object sender, EventArgs e)
    {
        rand = new Random();

        subject = "meeting event";
        body = "invitation meeting test";
        date = new DateTime(2014,1,1);
        uid = "CHE-106.802.033";

        openEventCalendar();
    }

    public void openEventCalendar()
    {
        Response.ContentType = "text/v-calendar";
        Response.AddHeader(

        "content-disposition", "attachment; filename=" + subject + ".ics");
        Response.Write("BEGIN:VCALENDAR" + Environment.NewLine);
        Response.Write(

        "PRODID: -//Microsoft Corporation//Outlook 12.0 MIMEDIR//EN" + Environment.NewLine);
        Response.Write("VERSION:2.0" + Environment.NewLine);
        Response.Write(

        "METHOD:PUBLISH" + Environment.NewLine);
        Response.Write("X-MS-OLK-FORCEINSPECTOROPEN:TRUE" + Environment.NewLine);
        Response.Write(

        "BEGIN:VEVENT" + Environment.NewLine);
        Response.Write("CLASS:PUBLIC" + Environment.NewLine);
        Response.Write(

        "CREATED:" + date.ToString("s") + Environment.NewLine);
        Response.Write("DESCRIPTION:" + body + Environment.NewLine);
        Response.Write(

        "DTEND:" + date.AddMinutes(30).ToString("s") + Environment.NewLine);
        Response.Write("DTSTAMP:" + date.ToString("s") + Environment.NewLine);
        Response.Write(

        "DTSTART:" + date.ToString("s") + Environment.NewLine);
        Response.Write("LAST-MODIFIED:" + date.ToString("s") + Environment.NewLine);
        Response.Write(

        "LOCATION:LM Reminder" + Environment.NewLine);
        Response.Write("PRIORITY:5" + Environment.NewLine);
        Response.Write(

        "SEQUENCE:0" + Environment.NewLine);
        Response.Write("SUMMARY;LANGUAGE=en-us:" + subject + Environment.NewLine);
        Response.Write(

        "TRANSP:OPAQUE" + Environment.NewLine);
        Response.Write(string.Format("UID:{0}-{1}", uid, rand.Next(1000)) + Environment.NewLine);

        //Response.Write(@"X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 3.2//EN>\n<HTML>\n<HEAD>\n<META NAME='Generator' CONTENT='MS Exchange Server version 08.00.0681.000'>\n<TITLE></TITLE>\n</HEAD>\n<BODY>\n\n\n<P DIR=LTR><SPAN LANG='en-us'></SPAN><SPAN LANG='en-us'></SPAN><SPAN LANG='en-us'><FONT SIZE=2 FACE='Arial'>" + Body + "</FONT></SPAN><SPAN LANG='en-us'></SPAN><SPAN LANG='en-us'></SPAN><SPAN LANG='en-us'></SPAN></P>\n\n</BODY>\n</HTML>" + Environment.NewLine);
        Response.Write("SUMMARY:" + subject + Environment.NewLine);
        Response.Write(

        "X-MICROSOFT-CDO-BUSYSTATUS:BUSY" + Environment.NewLine);
        Response.Write("X-MICROSOFT-CDO-IMPORTANCE:1" + Environment.NewLine);
        Response.Write(

        "BEGIN:VALARM" + Environment.NewLine);
        Response.Write("TRIGGER:-PT15M" + Environment.NewLine);
        Response.Write(

        "ACTION:DISPLAY" + Environment.NewLine);
        Response.Write("DESCRIPTION:Reminder" + Environment.NewLine);
        Response.Write(

        "END:VALARM" + Environment.NewLine);
        Response.Write("END:VEVENT" + Environment.NewLine);
        Response.Write(

        "END:VCALENDAR" + Environment.NewLine);

    }
4

2 に答える 2

1

次の出席者行をファイルに追加できます。

Response.Write("ATTENDEE;CN=\"Toto Tutu\";RSVP=TRUE:mailto:toto.tutu@test.com");
于 2013-06-05T13:47:18.237 に答える
0

ICSファイルを送信する前に、これらのフィールドに入力してください。

        string ddstart = scheduledDate;
        string ddend = string.Empty;
        string duration = string.Empty;
        ddend = scheduledDate;

        string method = "REQUEST";
        string status = "CONFIRMED";
        string UID = Guid.NewGuid().ToString();
        string lastmodified = scheduledDate;
        string created = scheduledDate;
        string dtstamp = scheduledDate;
        string sequence ="0";
        Dictionary<string, string> keycollection = new Dictionary<string, string>{
                        {"[YYYYMMDD]", ddstart},
                        {"[SCHEDULERNAME]", scheduler},
                        {"[SCHEDULEREMAIL]", scheduleremail},   
                        {"[CANDIDATENAME]", applicant},
                        {"[CANDIDATEEMAIL]", applicantemail},
                        {"[INTERVIEWERNAME]", interviewer},
                        {"[INTERVIEWEREMAIL]", intervieweremail},
                        {"[YYYYMMDDTHHmmssZ]",lastmodified},
                        {"[VENUE]", venue},
                        {"[NOTES]",notes},
                        {"[GUID]",UID},
                        {"[subject]","Interview scheduled"},
                        {"[method]",method},
                        {"[status]",status},{"[sequence]",sequence}};

 attachment = StringHelpers.ReplaceStringValue(attachment, keycollection);
        byte[] byteArray = Encoding.UTF8.GetBytes(attachment);          
        MemoryStream MemoryStreamData= new MemoryStream(byteArray);

その後、この ics ファイル ストリームを添付ファイルに追加します。

            From = From,
            FromDisplayName = FromDisplayName,
            To = To,
            Cc = Cc,
            Bcc = Bcc,
            Subject = Subject,
            MailTemplate = MailTemplate,
            Header = "\"X-UUID\" " + DateTime.Now,
            HeaderCategory = HeaderCategory,
            Actiontype = Actiontype,
            KeyValueCollection = KeyValueCollection,
            AttachmentFileName = AttachmentFileName,
            MemoryStreamData = MemoryStreamData

この添付ファイルをメールに送信すると、希望する応募者に届きます。これを試してみてください。

于 2016-07-27T09:56:52.370 に答える