`
geovindu
  • 浏览: 17997 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

csharp create ICS file extension

 
阅读更多
    

            string schLocation = "Conference Room 涂聚文约会你";
            string schSubject = "Business visit discussion约会";
            string schDescription = "Schedule description明天到深圳市福田區車公廟冶金大大廈約會";
            System.DateTime schBeginDate = Convert.ToDateTime("2/3/2012 10:00:00 PM");
            System.DateTime schEndDate = Convert.ToDateTime("2/3/2012 11:00:00 PM");

            

            String[] content = { "BEGIN:VCALENDAR",
                              "PRODID:-//Flo Inc.//FloSoft//EN",
                              "BEGIN:VEVENT",
                              "DTSTART:" + schBeginDate.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z"), 
                              "DTEND:" + schEndDate.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z"), 
                              "LOCATION:" + schLocation, 
                                "PRIORITY:1",
                                 "SEQUENCE:0",
	                            "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" + schDescription,
                              "SUMMARY:" + schSubject, "PRIORITY:3", 
                            "SEQUENCE:0",
	                     "END:VEVENT", "END:VCALENDAR" };
            String [] contents1={"BEGIN:VCALENDAR",
                "PRODID:-//XYZ Corp//My Product//EN",
                "VERSION:2.0",
                "CALSCALE:GREGORIAN",
                "METHOD:PUBLISH",
                "X-WR-CALNAME:My Calendar",
                "X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)",
                "BEGIN:VEVENT",
                "DTSTART:20061021T100000Z",
                "DTEND:20061021T130000Z",
                "DTSTAMP:20090211T175526Z",
                "UID:5f98dfd5-ac72-4ae1-b3c2-799a4e7c91f9",
                "CLASS:PUBLIC",
                "CREATED:20071104T183833Z",
                "DESCRIPTION: My description text.",
                "LAST-MODIFIED:20071104T183833Z",
                "LOCATION:涂聚文约会你 地址:123 Anywhere Street\\; Anyplace, NJ 12345\\; US",
                "SEQUENCE:0",
                "STATUS:CONFIRMED",
                "SUMMARY: My summary text.",
                "TRANSP:OPAQUE",
                "END:VEVENT",
                "BEGIN:VEVENT",
                "DTSTART:20061101T170000Z",
                "DTEND:20061101T180000Z",
                "DTSTAMP:20090211T175526Z",
                "UID:6eaef015-eb90-4e94-8e6c-0003b928969a",
                "CLASS:PUBLIC",
                "CREATED:20071104T183833Z",
                "DESCRIPTION: My description for number 2.",
                "LAST-MODIFIED:20071104T183833Z",
                "LOCATION: 涂聚文约会你 地址:123 Anywhere Street\\; Anyplace, NJ 12345\\; US",
                "SEQUENCE:0",
                "STATUS:CONFIRMED",
                "SUMMARY: My summary for #2.",
                "TRANSP:OPAQUE",
                "END:VEVENT",
                "END:VCALENDAR"
            };

            String [] contents2={
                "BEGIN:VCALENDAR",
                "PRODID:-//XYZ Corp//My Product//EN",
                "VERSION:2.0",
                "CALSCALE:GREGORIAN",
                "METHOD:PUBLISH",
                "X-WR-CALNAME:My Calendar",
                "X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)",
                "BEGIN:VEVENT",
                "DTSTART:20061021T100000Z",
                "DTEND:20061021T130000Z",
                "DTSTAMP:20090211T175526Z",
                "UID:5f98dfd5-ac72-4ae1-b3c2-799a4e7c91f9",
                "CLASS:PUBLIC",
                "CREATED:20071104T183833Z",
                "DESCRIPTION: My description text.",
                "LAST-MODIFIED:20110721T105554Z",
            "LOCATION:涂聚文约会你",
            "SEQUENCE:0",
            "STATUS:CONFIRMED",
            "SUMMARY:Insert something",
            "TRANSP:OPAQUE",
            "BEGIN:VALARM",
            "ACTION:DISPLAY",
            "DESCRIPTION:This is an event reminder",
            "TRIGGER:-P0DT0H10M0S",
            "END:VALARM",
            "END:VEVENT",
            "BEGIN:VEVENT",
            "DTSTART:20110909T083000Z",
            "DTEND:20110909T103000Z",
            "DTSTAMP:20110722T004312Z",
            "UID:e5fhdjff6vakjftnl3l9vjs64k@google.com",
            "CREATED:20110721T105410Z",
            "DESCRIPTION:涂聚文明天到深圳市福田區車公廟冶金大廈約會",
            "LAST-MODIFIED:20110721T111008Z",
            "LOCATION:涂聚文约会",
            "SEQUENCE:1",
            "STATUS:CONFIRMED",
            "SUMMARY:Insert something",
            "TRANSP:OPAQUE",
            "BEGIN:VALARM",
            "ACTION:DISPLAY",
            "DESCRIPTION:Insert something",
            "TRIGGER:-P0DT0H10M0S",
            "END:VALARM",
            "END:VEVENT",
            "END:VCALENDAR"
            };

             String [] contents3={"BEGIN:VCALENDAR",
                    "PRODID:-//Google Inc//Google Calendar 70.9054//EN",
                    "VERSION:2.0",
                    "CALSCALE:GREGORIAN",
                    "METHOD:PUBLISH",
                    "X-WR-CALNAME:涂聚文约会你",
                    "X-WR-TIMEZONE:Insert something",
                    "X-WR-CALDESC:",
                    "BEGIN:VEVENT",
                    "DTSTART:20110909T180000Z",
                    "DTEND:20110909T200000Z",
                    "DTSTAMP:20110722T004312Z",
                    "UID:et53m4on1ii70en7uuv1thjr58@google.com",
                    "CREATED:20110721T105553Z",
                    "DESCRIPTION:",
                    "LAST-MODIFIED:20110721T105554Z",
                    "LOCATION:涂聚文约会你",
                    "SEQUENCE:0",
                    "STATUS:CONFIRMED",
                    "SUMMARY:Insert something",
                    "TRANSP:OPAQUE",
                    "BEGIN:VALARM",
                    "ACTION:DISPLAY",
                    "DESCRIPTION:This is an event reminder",
                    "TRIGGER:-P0DT0H10M0S",
                    "END:VALARM",
                    "END:VEVENT",

                    "BEGIN:VEVENT",
                    "DTSTART:20110909T083000Z",
                    "DTEND:20110909T103000Z",
                    "DTSTAMP:20110722T004312Z",
                    "UID:e5fhdjff6vakjftnl3l9vjs64k@google.com",
                    "CREATED:20110721T105410Z",
                    "DESCRIPTION:",
                    "LAST-MODIFIED:20110721T111008Z",
                    "LOCATION:Auckland",
                    "SEQUENCE:1",
                    "STATUS:CONFIRMED",
                    "SUMMARY:涂聚文约会你",
                    "TRANSP:OPAQUE",
                    "BEGIN:VALARM",
                    "ACTION:DISPLAY",
                    "DESCRIPTION:Insert something",
                    "TRIGGER:-P0DT0H10M0S",
                    "END:VALARM",
                    "END:VEVENT",

                    "END:VCALENDAR"
             };

             String [] contents4={"BEGIN:VCALENDAR",
                "PRODID:-//Microsoft Corporation//Outlook 12.0 MIMEDIR//EN",
                "VERSION:2.0",
                "METHOD:PUBLISH",
                "X-CALSTART:20100611T140000Z",
                "X-CALEND:20100711T201500Z",
                "X-WR-RELCALID:{0000002E-5A22-AA75-713B-5C3715764495}",
                "X-WR-CALNAME: World Cup Football Complete Match Schedule 2010 South Africa",
                "BEGIN:VEVENT",
                "CATEGORIES:World Cup Football Complete Match Schedule 2010 South Africa",
                "CLASS:PUBLIC",
                "CREATED:20100608T231102Z",
                "DESCRIPTION:Group A\nFollow MarkThisDate on Twitter   markthisdate", 
                "DTEND:20100611T154500Z",
                "DTSTAMP:20100513T100200Z",
                "DTSTART:20100611T140000Z",
                "LAST-MODIFIED:20100608T231102Z",
                "LOCATION:涂聚文约会你",
                "PRIORITY:5",
                "SEQUENCE:0",
                "SUMMARY:涂聚文约会你 地址:涂聚文明天到深圳市福田區車公廟冶金大廈約會",
                "TRANSP:TRANSPARENT",
                "UID:005ef5a170ab453276aad021756e5fde@dusystem.com",
                "X-MICROSOFT-CDO-BUSYSTATUS:FREE",
                "X-MICROSOFT-CDO-IMPORTANCE:1",
                "END:VEVENT",
                "BEGIN:VEVENT",
                "CATEGORIES:涂聚文约会你 地址:涂聚文明天到深圳市福田區車公廟冶金大廈約會",
                "CLASS:PUBLIC",
                "CREATED:20100608T231102Z",
                "DESCRIPTION:天下为公",
                "DTEND:20100611T201500Z",
                "DTSTAMP:20100513T100200Z",
                "DTSTART:20100611T183000Z",
                "LAST-MODIFIED:20100608T231102Z",
                "LOCATION:Cape Town ",
                "PRIORITY:5",
                "SEQUENCE:0",
                 "SUMMARY:Uruguay - France",
                "TRANSP:TRANSPARENT",
                "UID:9660590c514358c5bceed9e75bed0222@dusystem.com",
                "X-MICROSOFT-CDO-BUSYSTATUS:FREE",
                "X-MICROSOFT-CDO-IMPORTANCE:1",
                "END:VEVENT",
                "BEGIN:VEVENT",
                "CATEGORIES:涂聚文约会你 地址:World Cup Football Complete Match Schedule 2010 South Africa",
                "CLASS:PUBLIC",
                "CREATED:20100608T231102Z",
                "DESCRIPTION:不作為的官都在步步高升",
                "DTEND:20100612T131500Z",
                "DTSTAMP:20100513T100200Z",
                "DTSTART:20100612T113000Z",
                "LAST-MODIFIED:20100608T231102Z",
                "LOCATION:不作為的官都在步步高升",
                "PRIORITY:5",
                "SEQUENCE:0",
                "SUMMARY:Korea Republic - Greece",
                "TRANSP:TRANSPARENT",
                "UID:5a9eaca2435fb52e1c95ddb786f82efa@dusystem.com",
                "X-MICROSOFT-CDO-BUSYSTATUS:FREE",
                "X-MICROSOFT-CDO-IMPORTANCE:1",
                "END:VEVENT",
                "END:VCALENDAR"
                };

           String [] contents5={"BEGIN:VCALENDAR",
                "PRODID:-//Microsoft Corporation//Outlook 12.0 MIMEDIR//EN",
                "VERSION:2.0",
                "METHOD:PUBLISH",
                "X-MS-OLK-FORCEINSPECTOROPEN:TRUE",
                "BEGIN:VEVENT",
                "CLASS:PUBLIC",
                "CREATED:20120203T120222Z",
                "DESCRIPTION:Schedule description明天到深圳市福田區車公廟冶金大廈約會",
                "DTEND:20120203T150000Z",
                "DTSTAMP:20120203T120200Z",
                "DTSTART:20120203T140000Z",
                "LAST-MODIFIED:20120203T120222Z",
                "LOCATION:Conference Room 涂聚文约会你",
                "PRIORITY:1",//提醒时间
                "SEQUENCE:0",
                "SUMMARY:Business visit discussion约会",
                "TRANSP:OPAQUE",
                "UID:040000008200E00074C5B7101A82E00800000000B0D4B7BDAEE2CC01000000000000000010000000C05DF5EA2953C0499548F598C334C23C",
                "DESCRIPTION: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 ve"+
	                "rsion 08.00.0681.000>\n<TITLE></TITLE>\n</HEAD>\n<BODY>\n<!-- Converted f"+
	                "rom text/plain format -->\n\n<P>Schedule description明天到深圳市福"+
	                "田區車公廟冶金大大廈約會\n</P>\n\n</BODY>\n</HTML>",
                "X-MICROSOFT-CDO-BUSYSTATUS:BUSY",
                "X-MICROSOFT-CDO-IMPORTANCE:2",
                "BEGIN:VALARM",
                "TRIGGER:-PT1440M",
                "ACTION:DISPLAY",
                "DESCRIPTION:Reminder",
                "END:VALARM",
                "END:VEVENT",
                "END:VCALENDAR"};
          
            System.IO.File.WriteAllLines(Server.MapPath("Sample2.ics"), content,System.Text.Encoding.UTF8);
            System.IO.File.WriteAllLines(Server.MapPath("Sample3.ics"), contents1, System.Text.Encoding.UTF8);
            System.IO.File.WriteAllLines(Server.MapPath("Sample4.ics"), contents2, System.Text.Encoding.UTF8);
            System.IO.File.WriteAllLines(Server.MapPath("Sample5.ics"), contents3, System.Text.Encoding.UTF8);
            System.IO.File.WriteAllLines(Server.MapPath("Sample6.ics"), contents4, System.Text.Encoding.UTF8);
            System.IO.File.WriteAllLines(Server.MapPath("Sample7.ics"), contents5, System.Text.Encoding.UTF8);
            //METHOD TO SEND EMAIL IS CALLED
            SendMail();
            //Thread t1 = new System.Threading.Thread(new ThreadStart(SendMail));
            //t1.Start();


分享到:
评论

相关推荐

    VSCODE csharp extension

    "VSCODE csharp extension"就是这样一个专为VSCODE设计的C#扩展插件,旨在提升C#开发者的效率和体验。 **C#扩展插件详解** 1. **Omnisharp**: Omnisharp是这个插件的核心组成部分,它是一个开源的C#语言服务器,为...

    Get a File’s Extension

    String extension = file.getName().substring(file.getName().lastIndexOf(".") + 1); // extension 的值为 "txt" ``` 5. **在JavaScript中**: - 可以通过字符串操作获取: ```javascript var fileName = ...

    CSharp高級編程(中文第七版).pdf.File1

    copy "D:\CSharp高級編程(中文第七版).pdf.File1"/B +

    C# File文件操作

    首先,`File.Create()`方法用于创建一个新的文件。如果文件已存在,它将被覆盖。这个方法返回一个FileStream对象,你可以用它来写入数据。例如: ```csharp using System.IO; // 创建一个新文件 FileStream fs = ...

    8-2-4.rar_csharp file encrypt_des_encrypt file csharp

    檔案加解密程式-使用DES對稱式金鑰加密演算法進行檔案加密

    Learning CSharp

    Learning CSharp Learning CSharp Learning CSharp Learning CSharp

    UHFReader18CSharp.rar_UHFREADER18CSharp_spiten5p

    标题中的“UHFReader18CSharp.rar_UHFREADER18CSharp_spiten5p”指的是一个关于UHF RFID阅读器(UHFReader18)的C#开发库资源,其中可能包含了针对该硬件设备的C#接口和示例代码。这个库可能是为了帮助开发者在C#...

    RSA-csharp.rar

    此RAR压缩包"RSA-csharp.rar"可能包含了一个C#项目或代码示例,用于演示如何在.NET Core平台上使用RSA算法。 RSA的核心原理基于大整数因子分解的困难性,即找到两个大素数p和q,然后计算它们的乘积n=p*q,n称为模数...

    Assembly-CSharp.dll

    Assembly-CSharp.dll

    CSharp IO操作全部内容

    例如,使用`File.Create()`创建新文件,`File.OpenRead()`和`File.OpenWrite()`读写文件,以及`File.WriteAllText()`和`File.ReadAllLines()`一次性读写文本。 3. **文件流**:`FileStream`是处理二进制文件的基础...

    c#(csharp)串口通信程序

    在本文中,我们将深入探讨C#(CSharp)中的串口通信程序,这是一个在嵌入式系统、自动化设备以及各种物联网(IoT)应用中广泛使用的通信技术。通过使用C#进行串口通信,开发者可以与硬件设备进行交互,接收或发送数据...

    CSharp语言参考.CHM CSharp语言参考.CHM CSharp语言参考.CHM

    CSharp语言参考.CHMCSharp语言参考.CHMCSharp语言参考.CHMCSharp语言参考.CHMCSharp语言参考.CHM

    CSharp使用DLL进行调用MatLab混编

    CSharp使用DLL进行调用MatLab混编 本文将详细介绍如何使用CSharp调用MatLab DLL,生成DLL库,并使用CSharp调用DLL,实现MatLab混编。 一、生成DLL库 在生成DLL库之前,需要进行函数准备和环境预设。函数准备是指...

    CSharp60Support 2.0.6

    5. **using指令块**:可以使用`using var`声明和初始化一个临时对象,该对象在作用域结束时会自动被 Dispose,如`using var stream = new FileStream("file.txt");`。 6. **静态索引器**:类可以定义静态索引器,...

    csharp_精选实例

    csharp_精选实例

    CreateCurve.rar_C#动态曲线图_csharp 曲线_动态 CSharp_绘制三维曲线_绘制曲线图

    本项目"CreateCurve.rar"提供了一种方法,利用C#来实现动态曲线的绘制,支持多条曲线同时显示,并且能够进行平面与三维视角的切换以及缩放功能。下面我们将详细探讨这些知识点。 首先,C#中的曲线图绘制通常借助...

    Csharp-Save-File:简单的C#脚本将文件保存到二进制文件

    using (FileStream outputStream = new FileStream(outputFile, FileMode.Create)) { outputStream.Write(fileBytes, 0, fileBytes.Length); } } ``` 在这个方法中,`inputFile`参数是源文件路径,`outputFile`...

    Microsoft.CSharp.dll

    Microsoft.CSharp

    microsoft.csharp_dll 下载 csdn C# wpf开发用

    《microsoft.csharp_dll在C# WPF开发中的重要角色》 在软件开发的世界里,Microsoft的.NET框架扮演着至关重要的角色,而其中的microsoft.csharp_dll则是.NET框架的一部分,专门为C#语言提供支持。这个动态链接库...

Global site tag (gtag.js) - Google Analytics