I still can't get the Event Handler to add an item to the Event list. I added site.AllowUnsafeUpdates = True as well as creating a custom configuration file based on the WSSSDK articlel on Code Access Security for Administrators to add the following:
<IPermission class="SharePointPermission"
version="1"
UnsafeSaveOnGet="True"
/>
Still no luck. Anyone??? Here is the pertinent code:
Case SPListEventType.Insert
'Perform necessary actions for the Insert event
Dim uri As New System.Uri(SharePointWeb.Url)
Dim virtualServer As SPVirtualServer = globalAdmin.OpenVirtualServer(uri)
Dim siteCollections As SPSiteCollection = virtualServer.Sites
Dim url As String = "http://........./sites/facilities"
Dim siteCollection As New SPSite(url)
Dim site As SPWeb
site.AllowUnsafeUpdates = True
site = siteCollection.AllWebs("Facilities")
Dim destList As SPList = site.Lists("Current Facilities Schedule")
sLog = sLog + " <destList.ID>: " + destList.ID.ToString + vbCrLf + vbCrLf
sLog = sLog + " <allowUnsafeUpdates>: " + site.AllowUnsafeUpdates.ToString + vbCrLf + vbCrLf
Dim listItems As SPListItemCollection = destList.Items
Dim newItem As SPListItem = listItems.Add()
newItem("ID") = -1
newItem("fRecurrence") = 0
newItem("Title") = stitle
newItem("Created") = sCreated.ToString("yyyy-MM-dd") + "T00:00:00Z"
newItem("Created By") = sCreatedBy
newItem("Modified") = sModified.ToString("yyyy-MM-dd") + "T00:00:00Z"
newItem("Modified By") = sModifiedBy
newItem("Begin") = sBegin_date.ToString("yyyy-MM-dd") + "T00:00:00Z"
newItem("End") = sEnd_Date.ToString("yyyy-MM-dd") + "T00:00:00Z"
newItem("Room Resource") = sRoom_resource
newItem("Activity Type") = sActivity_Type
newItem("Comments") = scomments
newItem("Approval Status") = 2 'Pending
newItem.Update()
'End If
sLog = sLog + "sInstructor_PC = <" + sInstructor_PC + "> " + vbCrLf
sLog = sLog + "sRoom_resource = <" + sRoom_resource + "> " + vbCrLf
EventLog.WriteEntry("Facilities Event Log ", sLog, EventLogEntryType.Information, listEvent.Type)
Case SPListEventType.Invalid
'Perform necessary actions for the Invalid event