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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically Importing Events

Status
Not open for further replies.

rway

MIS
Apr 22, 2005
4
US
I want to automatically import events into my event calendar from a file. Is there anyway of doing this automatically?


I am tired of entering events manually.


 
There is no standard way to do this, you can how ever realise this in a webpart. (i think never tried it my self)

This is what is involved:
1. a. read the file from the webpart
1. b. format the contents from the file by cutting/pasting.looping/enz
2. open the list through the object model
3. a. add the event to the list
3. b. save the list.

and there you have an event..


example of adding the event:
Code:
if (list.Title == "events")
{
    Web.AllowUnsafeUpdates = true;
    foreach(event in filewithevents) // you get the idea ?!
    {
       SPListItem itm = list.Items.Add();
       itm["EventDate"] = event.TheRightValue;
       itm["EndDate"] = event.TheRightValue;
       itm["Description"] = event.TheRightValue;
       itm.Update(); //save 
    }                
}

this are the most common fields (also check url below)

EventDate Begin DateTime
EndDate End DateTime
Description Description Note

for a complete list of fields that can be filled
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top