コード例 #1
0
        public override void ItemAdded(SPItemEventProperties properties)
        {
            try
            {
                SocialEngineEvents.ItemAdded(properties);
            }
            catch { }

            try
            {
                //Initialize global variables
                if (Initialize(true, properties))
                {
                    //InsertItem
                    InsertItem(properties);
                }
                //Dispose of DAO
                _DAO.Dispose();
            }
            catch (Exception ex)
            {
                SPSecurity.RunWithElevatedPrivileges(delegate
                {
                    if (!EventLog.SourceExists("EPMLive Reporting Item Added"))
                    {
                        EventLog.CreateEventSource("EPMLive Reporting Item Added", "EPM Live");
                    }

                    using (var myLog = new EventLog("EPM Live", ".", "EPMLive Reporting Item Added"))
                    {
                        myLog.MaximumKilobytes = 32768;
                        myLog.WriteEntry(
                            string.Format(
                                "Name: {0} Url: {1} ID: {2} : {3}{4}",
                                _SiteName,
                                _SiteUrl,
                                _SiteID,
                                ex.Message,
                                ex.StackTrace),
                            EventLogEntryType.Error,
                            2001);
                    }
                });
            }
            finally
            {
                ClearResourceGridCache(properties);
            }
        }