public ITableView GetView(PredefinedListType predefinedListType, SortBy[] sortBy, PropertyDefinition[] propsToReturn) { return(this.InternalGetView(ListBaseType.Any, predefinedListType, sortBy, propsToReturn)); }
private ITableView InternalGetView(ListBaseType listBaseType, PredefinedListType predefinedListType, SortBy[] sortBy, params PropertyDefinition[] propsToReturn) { if (propsToReturn == null) { throw new ArgumentNullException("propsToReturn"); } if (propsToReturn.Length == 0) { throw new ArgumentException("propsToReturn"); } EnumValidator.ThrowIfInvalid <ListBaseType>(listBaseType, "listBaseType"); EnumValidator.ThrowIfInvalid <PredefinedListType>(predefinedListType, "listBaseType"); if (listBaseType != ListBaseType.Any && predefinedListType != PredefinedListType.Any) { throw new ArgumentException("listBaseType && predefinedListType"); } return(Utils.DoSharepointTask <ArrayTableView>(this.Identity, this.Id, (SharepointSiteId)this.Id, true, Utils.MethodType.GetView, delegate { List <object[]> list = new List <object[]>(); ArrayTableView result; using (Lists lists = new Lists(this.Uri.ToString())) { lists.Credentials = CredentialCache.DefaultCredentials; foreach (object obj in lists.GetListCollection().SelectNodes("/sp:List", SharepointHelpers.SharepointNamespaceManager)) { XmlNode xmlNode = (XmlNode)obj; object[] valuesFromCAMLView = SharepointHelpers.GetValuesFromCAMLView(SharepointListSchema.Instance, xmlNode, null, new PropertyDefinition[] { SharepointListSchema.ID, SharepointListSchema.ListType, SharepointListSchema.PredefinedListType, SharepointListSchema.IsHidden }); int num = 0; int num2 = num + 1; int num3 = num2 + 1; int num4 = num3 + 1; string text = valuesFromCAMLView[num] as string; if (text != null && valuesFromCAMLView[num2] is int && valuesFromCAMLView[num3] is int && valuesFromCAMLView[num4] is bool && !(bool)valuesFromCAMLView[num4]) { ListBaseType listBaseType2 = (ListBaseType)valuesFromCAMLView[num2]; PredefinedListType predefinedListType2 = (PredefinedListType)valuesFromCAMLView[num3]; if ((listBaseType == ListBaseType.Any || listBaseType == listBaseType2) && (predefinedListType == PredefinedListType.Any || predefinedListType == predefinedListType2)) { SharepointListId sharepointListId; if (listBaseType2 == ListBaseType.DocumentLibrary) { sharepointListId = new SharepointListId(text, this.Uri, null, UriFlags.SharepointDocumentLibrary); } else { sharepointListId = new SharepointListId(text, this.Uri, null, UriFlags.SharepointList); } sharepointListId.Cache = new KeyValuePair <string, XmlNode>?(new KeyValuePair <string, XmlNode>(this.Identity.Name, xmlNode)); object[] valuesFromCAMLView2 = SharepointHelpers.GetValuesFromCAMLView(SharepointListSchema.Instance, xmlNode, null, propsToReturn); for (int i = 0; i < propsToReturn.Length; i++) { DocumentLibraryPropertyDefinition documentLibraryPropertyDefinition = propsToReturn[i] as DocumentLibraryPropertyDefinition; if (documentLibraryPropertyDefinition != null) { if (documentLibraryPropertyDefinition.PropertyId == DocumentLibraryPropertyId.Id) { valuesFromCAMLView2[i] = sharepointListId; } else if (documentLibraryPropertyDefinition.PropertyId == DocumentLibraryPropertyId.Uri) { Uri uri = SharepointHelpers.GetValuesFromCAMLView(SharepointListSchema.Instance, xmlNode, null, new PropertyDefinition[] { SharepointListSchema.DefaultViewUri })[0] as Uri; if (uri != null) { valuesFromCAMLView2[i] = new UriBuilder(sharepointListId.SiteUri.Scheme, sharepointListId.SiteUri.Host, sharepointListId.SiteUri.Port, uri.ToString()).Uri; } } } } list.Add(valuesFromCAMLView2); } } } result = new ArrayTableView(null, sortBy, propsToReturn, list); } return result; })); }
public ITableView GetView(PredefinedListType predefinedListType, params PropertyDefinition[] propsToReturn) { return(this.InternalGetView(ListBaseType.Any, predefinedListType, null, propsToReturn)); }