Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File System Object 1

Status
Not open for further replies.

EnemyGateIsDown

Technical User
Oct 3, 2002
235
GB
Hi guys,

Quick question, in ASP I used to used the file system object to manipulate files such as

Code:
fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.CreateTextFile(session("AppDir") & "\" & ICS_ID &".ics", True)
a.WriteLine(strICS)
a.Close

How can I do the same thing in vb.net?

Any help is as always greatly appreciated.

Cheers,

Chris
 
Hi,

Just to make sure, you want to do it in VB.NET, as a windows application, right? (not ASP.NET)

What is the "strICS" ?
 
Hi

Yes im looking to do it in VB.Net..

strICS contains a string which makes up an iCalendar file entry looking something like:

Code:
       strICS = "BEGIN:VCALENDAR" & vbCrLf
        strICS = strICS & "PRODID:-//Microsoft Corporation//Outlook 9.0 MIMEDIR//EN" & vbCrLf
        strICS = strICS & "VERSION:2.0" & vbCrLf
        strICS = strICS & "METHOD:REQUEST" & vbCrLf
        strICS = strICS & "BEGIN:VEVENT" & vbCrLf
        strICS = strICS & "ATTENDEE;CN=""" & emailto & """;ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:" & emailto & vbCrLf
        strICS = strICS & "ORGANIZER:MAILTO:" & emailto & vbCrLf
        strICS = strICS & "DTSTART:" & ICSDate(IsoDate(StartDate)) & vbCrLf
        strICS = strICS & "DTEND:" & ICSDate(IsoDate(EndDate)) & vbCrLf
        strICS = strICS & "LOCATION:" & sLocation & vbCrLf
        strICS = strICS & "TRANSP:OPAQUE" & vbCrLf
        strICS = strICS & "SEQUENCE:0" & vbCrLf
        strICS = strICS & "UID:" & sbooker & vbCrLf
        strICS = strICS & "DTSTAMP:20060626T104103Z" & vbCrLf
        strICS = strICS & "SUMMARY:" & sSubject & vbCrLf
        strICS = strICS & "PRIORITY:5" & vbCrLf
        strICS = strICS & "CLASS:PUBLIC" & vbCrLf
        strICS = strICS & "BEGIN:VALARM" & vbCrLf
        strICS = strICS & "TRIGGER:PT15M" & vbCrLf
        strICS = strICS & "ACTION:DISPLAY" & vbCrLf
        strICS = strICS & "DESCRIPTION:Reminder" & vbCrLf
        strICS = strICS & "END:VALARM" & vbCrLf
        strICS = strICS & "END:VEVENT" & vbCrLf
        strICS = strICS & "END:VCALENDAR" & vbCrLf
 
Something like:



Dim a As System.IO.StreamWriter = _
System.IO.File.CreateText(Application.StartupPath & "\" & ICS_ID & ".ics")
a.Write(strICS)
a.Close()
 
Thanks.. thats exactly what Im after.. Im slowly getting to grips with the VB.NET object heirarchy :)

Cheers,

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top