Let's say I have a site level feature that has a content type, and a web level feature that has a list instance with items of the previously mentioned content type. If I enable the web feature for 100+ different webs, so I get 100+ lists from the same list instance definition and content type, what's the fastest way to get items from all those lists? Iterating through the webs and getting list items for each list one by one is very slow.
Use Method Below.
SPSiteDataQuery
The fastest way (and only way in my opinion) is to use the search engine.
You can do queries like "contenttype:document" to search for document across lists.
Related
I am attempting to create a WebPart in Kentico 11 that supports handling an n-length list of items. I found that creating a WebPart with property fields is pretty straightforward in Kentico, but I am having trouble finding documentation on how to best set up a WebPart that can lookup & output multiple model objects.
I've tried the following approach, but it has some drawbacks that I'm not entirely comfortable with:
Set up a Container page type to place instances of data objects inside. I restricted it to ensure that only my custom Page Type data object is available as a child of it.
Place a Pages DataSource in the template zone and direct it to the Container page.
Hook up a Repeater element to it and apply a transformation & content before+after to the Repeater.
While this works, it feels a little cludgey. Content editors have to be wise enough to know how to set up DataSources & Repeaters, plus how to bind them together and apply transforms, and additionally remember to fill in the content before and content after fields with the appropriate wrapping HTML markup.
This is not something that I expect a content editor should need to remember.
Is there a cleaner way to put lists of items inside of a template zone without needing to drag & configure a datasource and container page?
I did not see any way to set up a Page Type field in such a way that it would essentially model a one-to-many relationship with another Page Type. Did I miss something there? If I could do that, then I could write a transformation to handle the wrapping HTML markup, and the looping of children. Haven't been able to find a way to make this work though.
The best way to accomplish what you are asking is with a custom form control. In your case, the form control should be able to let users select multiple items.
You can actually use 'Sortable multiple object selector' marketplace item for this purpose. This form control will enable you to select multiple items based on a certain type (that you need to configure in code) and editors would simply use the select dialog to choose the items.
I'm working on a checklist web app
Now, every user can have lots of check lists, each with many items on them.
Would it be a good idea to keep the items in a JS object in the individual checklist? This would have been my first approach, since there wouldn't be a lot of sorting or anything happening on those items.
Now I'm thinking about putting every item in an individual file (because I might do stuff like deadlines and assignments for individual items)
This seems like a lot of files to me. Maybe I underestimate CouchDB. Would this be a good approach to the problem?
Store every list item as new document.
Every list item document should have properties like listname, deadline and/or assignment.
You don't need (but you can have) extra docs to express hierarchy or nested relations. That what CouchDB views for - e.g. you will build a view getListItemsByListname with the listname as key to get all items of one list.
I'm new to Orchard but from various blog posts and SO answers it seems that Lists would help me achieve what I want. Unfortunately it seems that Lists have now been deprecated.
The documentation at http://docs.orchardproject.net/Documentation/Creating-lists suggests using Taxonomies instead. Is it possible to achieve the functionality of a List using Taxonomies?
You can use taxonomies to produce a list of content items. Create your taxonomy, add some items to it, attach the taxonomy field to your content type, and select the taxonomy you want to be displayed in the content type settings. Create a content item with a taxonomy selected then go to the url:
/taxonomy-name/*selected-taxonomy-item*
and it should display a list of all items with that taxonomy selected.
However, lists were deprecated and replaced by Projections, I would recommend using these. They are part of core and can be enabled from the backend. You can then create a query with your projection uses. This query determines what items you want displaying. It is pretty nice and simple, just need to play around with it. Let me know if you need more details about it, or probably just googling Orchard Projections will produce some useful links if you need to do some more complex things with it
Don't know how to google for such, but is there a way to query all the items where
Permissions are unique to listitem
These unique permissions contains assignment for specific group X.
Old post, but still getting plenty of views and I can't find anywhere more relevant to say this. There are some shortcuts available now, and you can use CAML to return only items with unique permissions, just not using the HasUniqueRoleAssignments property.
Sharing/setting unique permissions on a list item adds hidden "Field" nodes ("SharedWithDetails" & "SharedWithUsers") to it's SchemaXml property, which you can filter with CAML:
<View><Query><Where><IsNotNull><FieldRef Name='SharedWithDetails' /></IsNotNull></Where></Query></View>
Incidentally, setting a unique permission on an Item also seems to add a flag to the List itself, which is presumably how the /_layouts/15/uniqperm.aspx page manages to return answers on biiiig sites so quickly (and the cryptically vague "Lists that may contain items with unique permissions" message). You use this additional XML to identify lists that (probably) contain Items with unique permissions, which is vastly more efficient than enumerating every Item in the List to find out if any of them had unique permissions. This is particularly valuable if your Site contains many Lists, or any large Lists.
This PnP PowerShell code returns all lists that (probably) have items with unique permissions:
Get-PnPList -Includes SchemaXml | ? {$_.SchemaXML -match "SharedWithDetails"}
And once you have the list, you can use Get-PnPListItem and the above CAML query to efficiently return only the Items with unique permissions without having to enumerate/load every item in the List:
Get-PnPListItem -List [YourList] -Query "<View><Query><Where><IsNotNull><FieldRef Name='SharedWithDetails' /></IsNotNull></Where></Query></View>"
You will have to loop through the items and inspect the permissions item per item and update them if relevant. The more items you have the longer it takes. So not really a great solution.
An other solution is using the credentials of a user that is only member of group x.
SharePoint automatically takes permissions into account. So if you connect to the list using that user, you should only get the items on which the user has permissions.
Use the NetworkCredentials class for doing this.
Then use a CAML query to update your items.
--W
I don't think you can do this by shaping a CAML query and using the SPQuery object to get the items in this way.
My thinking would be to get all items, and loop through them testing for the HasUniqueRoleAssignments and RoleAssignments properties.
I am still new to sharepoint and would like to know if it is possible to make a query that works across several lists. My list looks like this
Customers (id, name and so forth)
Orders ( id, order number, customer and some additional info)
OrderItems (id, name, price, description and so on)
I would like to create a view that will display the OrderItems grouped by Order which again will be grouped by Customer.
In pure .net code that is pretty easy but is it possible to implement it only using sharepoint lists?
Without custom code or third party components you would have only a few options. Using SharePoint Designer to create a Data View or creating a custom Query with some complex CAML which I'm not even sure is entirely possible.
Personally I would look more towards using Master Detail functionality using a combination of web part connections and filtering. By activating Enterprise features you have available a number of Filter Web Parts that should be able to be combined to filter lists to selected values.
Personally I have gone with custom code to bring back list data based on queries and then used the GetDataTable() method of the SPListItemCollection object. Once you have the list items in DataTables you have numerouse ways to sort filter and aggregate the information.
I should add to this that there is a great article on displaying information from a dataset using the SPGridView and SPMenuField. Once you have your DataTables you could establish relationships in a dataset to display the information using these controls:
http://blogs.msdn.com/powlo/archive/2007/02/25/displaying-custom-data-through-sharepoint-lists-using-spgridview-and-spmenufield.aspx
Connected web parts can do this...
I think SPD can do that.
If you do not want get yourself dirty, take a look at SharePoint List Collection, which is perfect to you.