如何使用C#在现有日历文件中添加新事件 [英] How do I add new event in existing calendar file using C#

查看:198
本文介绍了如何使用C#在现有日历文件中添加新事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码创建了一个日历文件(.ics)。我通过谷歌搜索获得此代码。

I have created a calendar file(.ics) by using following code. i got this code by searching it in google.

string[] contents = { "BEGIN:VCALENDAR",
            "PRODID:-//Flo Inc.//FloSoft//EN",
            "BEGIN:VEVENT",
            "DTSTART:" + schBeginDate.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z"), 
            "DTEND:" + schEndDate.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z"), 
            "LOCATION:" + strLocation, 
            "DESCRIPTION;ENCODING=ESCAPED-CHAR:" + strDesc,
            "SUMMARY:" + "SKS TASK: "+A.task_title, 
            "PRIORITY:3", 
            "END:VEVENT", 
            "END:VCALENDAR" 
            };
            System.IO.File.WriteAllLines("Here My File Path/calendar".ics", contents);



现在我想要为这个已创建的文件添加新事件。对于Exaxple我有一个包含一个事件的日历,如果我添加第二个事件,它应该在相应的(.ics)文件中添加为新事件。

作为一个更新鲜的我不知道从哪里开始这项任务。

请指导我有用的文章和网址。



我尝试了什么:



我已经提到了上面的代码。我试图创建新的日历文件。现在想要添加新的事件到那个旧的file。


Now i want to add new events to this already created file. For Exaxple i have a calendar with one event, if i add second event it should add as a new event in that corresponding (.ics)file.
As a fresher i dont have knowledge that where to start for this task.
Please guide me with useful articles and Url.

What I have tried:

I have mentioned the code above. I tried to create new calendar file. Now want to add new event to that old file.

推荐答案

参见文件方法(System.IO) [ ^ ]。您可以使用AppendAllLines。
See File Methods (System.IO)[^]. You can use AppendAllLines.


这篇关于如何使用C#在现有日历文件中添加新事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆