// Uncomment the method below to handle the event raised after a feature has been activated. /// <summary> /// The feature activated. /// </summary> /// <param name="properties"> /// The properties. /// </param> public override void FeatureActivated(SPFeatureReceiverProperties properties) { SPSecurity.RunWithElevatedPrivileges(delegate { using (RecordCentreManager rcm = new RecordCentreManager("http://dev2010/sites/rc/")) { UnifiedLoggingServer.LogMedium(rcm.ToString()); } /*if ((properties.Feature.Parent as SPSite) != null) * using (SPSite spSite = properties.Feature.Parent as SPSite) * { * MessageBox.Show(spSite.Url); * using (SPWeb web2 = site.OpenWeb(properties.Web.ID)) * { * SPListItem item = web2.Lists.GetList(properties.List.ID, false).GetItemById(properties.ListItemId); * * Records.BypassLocks(item, delegate(SPListItem newItem) * { * newItem["Title"] = "Hello from code"; * newItem.Audit.WriteAuditEvent(SPAuditEventType.Custom, SPAuditEventSource.ObjectModel.ToString(), "<Data>Audit text</Data>"); * newItem.SystemUpdate(false); * }); * * } * }*/ }); }
/// <summary> /// The use properties. /// </summary> /// <param name="properties"> /// The properties. /// </param> private void UseProperties(SPItemEventProperties properties) { UnifiedLoggingServer.LogMedium("---- UseProperties ----"); if (properties.ListTitle.Contains("Drop Off Library")) { try { SPSecurity.RunWithElevatedPrivileges(delegate { SPListItem dropOffListItem = properties.ListItem; using (RecordCentreManager rcm = new RecordCentreManager(dropOffListItem, properties.WebUrl)) { UnifiedLoggingServer.LogMedium(rcm.ToString()); rcm.TraceLog("TraceLog_RCM_"); } }); } catch (Exception e) { throw new SPException("An error occured while processing the list Feature/ UseProperties.\n" + e.Message, e); } } }
public void TraceLogTest() { SPListItem dropOffListItem = null; // TODO: Initialize to an appropriate value string url = string.Empty; // TODO: Initialize to an appropriate value RecordCentreManager target = new RecordCentreManager(dropOffListItem, url); // TODO: Initialize to an appropriate value string header = string.Empty; // TODO: Initialize to an appropriate value target.TraceLog(header); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
/// <summary>Feature Activated.</summary> /// <param name="properties">The properties.</param> public override void FeatureActivated(SPFeatureReceiverProperties properties) { const string Url = "http://dev2010/sites/rc/"; RecordCentreManager rcm = new RecordCentreManager(Url); }