public SPListNode(SPList list) { base.Title = list.Title; base.SPObjectType = list.GetType().Name; base.Url = list.Title; base.IconPath = list.ImageUrl; }
private void PopulatePropertiesDropDown(SPList list) { DdListProperties.Items.Clear(); PropertyInfo[] props = list.GetType().GetProperties(); List <PropertyInfo> sortedProps = props.OrderBy(p => p.Name).ToList(); foreach (PropertyInfo pi in sortedProps) { DdListProperties.Items.Add(pi.Name); } }
protected void Button2_Click(object sender, EventArgs e) { SPSite site = new SPSite("http://xqx2012"); SPWeb web = site.AllWebs["ComputerCompetitive"];// SPList myList = web.Lists["mytask"]; //注册事件处理程序 myList.EventReceivers.Add(SPEventReceiverType.ItemUpdated, "TaskEventHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4f5a25a745ef7f27", "TaskEventHandler.TaskEventReceiver"); myList.Update(); ListBox1.Items.Clear(); ListBox1.Items.Add("baseType-" + myList.BaseType.ToString()); ListBox1.Items.Add("GetType-" + myList.GetType().ToString()); foreach (SPEventReceiverDefinition myEvet in myList.EventReceivers) { ListBox1.Items.Add(myEvet.Name); } }
private void SetViewRenderQueryParametersBSP2(SPList list, HttpContext context, string currentUrl, SPWeb web, string listName, string viewGuid, SPView designerView, bool gridview, string instanceID, string selectedID, string filterString, string rootFolder, string folderCtId, string paged, StringBuilder pagingTokens, int lastFilterIndex) { try { list.GetType().InvokeMember("SetViewRenderQueryParameters", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.InvokeMethod | BindingFlags.Instance, null, list, new object[] { context, currentUrl, web, listName, viewGuid, designerView, gridview, instanceID, selectedID, filterString, rootFolder, folderCtId, paged, pagingTokens, lastFilterIndex }); } catch (SecurityException ex) { throw new SPException(ex.TargetSite.Name, ex); } catch (Exception ex) { throw new SPException(ex.TargetSite.Name, ex); } }
private void BtnQueryProp_Click(object sender, EventArgs e) { SPList curList = TryGetSPList(); if (curList == null) { return; } try { RchTxtProperties.Text = curList.GetType().GetProperty(DdListProperties.Text).GetValue(curList, null).ToString(); } catch (SPException spex) { MessageBox.Show(spex.Message); Log.Error(spex); } catch (Exception ex) { MessageBox.Show(ex.Message); Log.Error(ex); } }
private static void SetViewRenderParametersSP2(SPList list, HttpContext context, string currentUrl, SPWeb web, string listName, string viewGuid, SPView designerView, bool gridview, string instanceID, string selectedID, string filterString, string rootFolder, string folderCtId, string paged, StringBuilder pagingTokens, int lastFilterIndex) { try { Type listType = list.GetType(); MethodInfo[] methodInfoArr = listType.GetMethods(BindingFlags.NonPublic | BindingFlags.Instance); MethodInfo methodInfo = listType.GetMethod("SetViewRenderQueryParameters", BindingFlags.NonPublic | BindingFlags.Instance, null, GetTypesForSetViewRenderParameters(), null); //SetViewRenderQueryParameters( // HttpContext context, // string currentUrl, // SPWeb web, // string listName, // string viewGuid, // SPView designerView, // bool gridview, // ref string instanceID, // ref string selectedID, // ref string filterString, // ref string rootFolder, // ref string folderCtId, // ref string paged, // ref string pagedPrev, // ref StringBuilder pagingTokens, // ref int lastFilterIndex) methodInfo.Invoke(list, new object[] { context, currentUrl, web, listName, viewGuid, designerView, gridview, instanceID, selectedID, filterString, rootFolder, folderCtId, paged, null, pagingTokens, lastFilterIndex }); } catch (SecurityException ex) { throw new SPException(ex.TargetSite.Name, ex); } catch (Exception ex) { throw new SPException(ex.TargetSite.Name, ex); } }