How to using SharePoint sdk grab data from pages library? - sharepoint

what is the best practice on how to programmatically get the pages data from multiple pages libraries (from different subsite)
please provide me some link on that, thank you.

Use a SPSiteDataQuery
Depending on the type of the page you could filter via the content type (e.g. "WelcomePage") or for all page types via the file extension "aspx".

Related

Create Modern Page inside custom library in SharePoint Online

I am using ConvertTo-PnPPage function in PnP PowerShell to convert classic page to modern page. I saw that if the page is inside Site Assets or any other custom library, then after conversion the page is created inside Site Pages library and within a folder named with the library name.
Can we create/convert modern page in the same library where the source page is present? Or Is there a restriction that modern pages are only available in Site Pages library? I tried finding about this in the documentation. But couldn't find related information.
Thank you!

Using PnP/CSOM to customise New SharePoint OOTB Document Libraries

Hoping someone could possibly help please.
Quite new to the PnP framework, but I have a template up and running, but I'm drawing a blank on customising the OOTB document library with our own custom content types and site columns. I’ve managed to do it for the initial provisioning process using PnP, but the bit I’m currently struggling with is when a user creates a new document library from either the 'addanapp.aspx' page or through a Modern Page, since that doesn’t use our content types or site columns, that just creates a default SPO Document Library.
I’ve been reading about the ECM Document Library core, List Definitions, Event Receivers and CSOM to achieve what I’m looking to do, but not sure where I should be starting.
Ideally, the outcome I'm looking to achieve is I want any new document library a user creates from a Modern Team Site to use only our custom content types and site columns, not the default OOTB ones.
Any help gratefully received, thanks.
Have you checked the demo ECM.DocumentLibraries?
Here is the general explanation video.
You need familiar with SharePoint add-in(app) first guideline here.

Sharepoint second page library

Sharepoint 07 has nice page library. You can create templates and then just by pressing Site-> 'Create a page' get a choice with page templates.
However if one tries to create second library, for example, document library, in the same site (node), then it is not possible to choose element type as "page". Only "wiki-pages" and "pages with web-parts"!
So, is it possible to get 2 or more page libraries in the same node?
It seems very inconvenient to create the hole new site or new node only just for page library.
The SharePoint Publishing Infrastructure can only handle a single Pages library per Web site, it's a physical limitation of the software.
You could create sub webs to separate out your content more, or create new Content Types inheriting from the "Page" content type, and add in extra columns to store metadata to further categorize your pages. You'd then add this new content type to the Pages library, and you can slot your new content into this content type to categorize it.
Luckily, I have discovered another solution. Using Metalogix Content Matrix I was able to copy and paste the 'Page' Library renaming it and Viola...it works! I'm able to edit pages without getting the "The SPListItem provided is not compatible with a Publishing Page" Error. Whohoo! I hope this helps you.

Programmatically access a SharePoint document library?

How would I programmatically access a SharePoint document library from another machine? I want to recursively scan all the folders and generate a list of files with a certain custom property.
You'll need to use the List Data Retrieval web service. Example code using the service can be found on the Query method page.
Vinny is correct. I just wanted to elaborate a little on the next version of SharePoint, SharePoint 2010. There are several client based models for access that essentially wrap the web service calls. There is a managed .NET dll for Windorm/WPF applications, a library for use within websites that is JavaScript based and a Silverlight based implementation.
This MSDN article has links to more information on all three.

Sharepoint: Best way to display lists of non-Sharepoint content with "compatible" UI?

I've built a web part for Sharepoint that retrieves data from an external service. I'd like to display the items in a way that's UI-compatible with Sharepoint (fits in with its surroundings.)
I'm aware of the "DataFormWebPart" but was unable to get one working properly. It requires a valid DataSource and I was unable to build one from the results of a web service call... Part of the problem is that my web service wrappers don't expose the XML return info, rather I have a bunch of deserialized objects. There doesn't seem to be an easy way to turn actual objects into a datasource, or populate a "generic" datasource from object data.
I could use an SPGridView to get the same UI, but the grid control doesn't have much in the way of smarts -and- it forces every field into its own column. I'd prefer to render each list item as a single cell with complex rendering (for instance the way that StackOverflow shows its lists of questions.) I'd also like to get as much of the Sharepoint-standard UI as possible, such as the sorting, filtering, and paging controls.
So, first: Has anyone here written a Sharepoint control that does this, and if so do you have sample code to share? If not: am I overlooking some useful control, whether MS-supplied or available in an external library?
Thanks!
Steve
Sharepoint: Best way to display lists
of non-Sharepoint content with
“compatible” UI?
Take a look at the built in sharepoint web controls:
Microsoft.SharePoint.WebControls Namespace
It contains all the controls used in sharepoint. I'd tell you more, but the documentation is very thorough.
Problem with SharePoint is that there are a bunch of different ways to do this. If your data is not changing too often and is not overly large it may be worth considering entering it into a list for display.
If you have the Enterprise licence it may be worth getting your data into the BDC and using it there.
you may have to convert the objects into xml or use the serialised objects with the XML webpart for display. This still has the issue of custom rendering using XSLT.
Here's a great article that explains how to configure BDC connections to web services using the BDC Definition Editor:
Creating a Web Service Connection by Using the Business Data Catalog Definition Editor
http://msdn.microsoft.com/en-us/library/bb737887.aspx
The best way to do this IMO is to make a Web Part. As a Web Part the UI will be automatically rendered to be the same as the theme the site is using (unless you override it) and it will be able to be placed anywhere by anyone with admin privileges.
Tutorial on making a Web Part
Tutorial on packaging and deploying a Web Part
Example Web Part Source Code
You could create a custom web part and use an SPGridView. You say you don't like it, because it forces every field into its own column, but that's not true. You can create a template (ITemplate) for every column and fully customize what's shown inside it, just like you would using a normal ASP.Net GridView. Using this approach I've added the little "New" images right next to a list item's Title, just like SharePoint does itself.

Resources