Articles about European Sharepoint Hosting Service
Posts tagged Hosting fast SharePoint 2013 Hosting
SharePoint 2013 Hosting – HostForLIFE.eu :: Find All Lists And Libraries Using Infopath In SharePoint
May 9th
InfoPath is one of the most popular and widely used forms design and development solution that developers and IT consultants use alike, primarily across on-premise versions. However, there are no direct out-of-the-box means of identifying lists/libraries using InfoPath.
Once again, PowerShell comes to the rescue. Using a simple PowerShell, we can easily identify the lists/libraries using InfoPath Forms. We can extend it and generate a report out of it as well.
This script can identify all the lists and libraries that use InfoPath. This can be useful for scenarios like –
- Identify lists using InfoPath to consider them for replacement with other solutions like Nintex Forms, K2 SmartForms, etc.
- Convert/Re-engineer InfoPath forms to PowerApps
- Generate a report containing lists using InfoPath form, and replace them with CSOM designs
- User Profile service embedded in InfoPath works differently in SharePoint 2016 than that of SharePoint 2010. A report of all InfoPath enabled list/library will be beneficial to perform the fix.
The Script
1 |
######################################### #### Infopath Usage Identifier #### #### Scope - Site Collection #### #### Input - Site Collection URL #### ######################################### $siteCollectionURL = "http://sharepoint.devbox.com/sites/mysitecollection" if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) { Add-PSSnapin Microsoft.SharePoint.PowerShell; } try { $mySite = Get-SPSite -Identity $siteCollectionURL $myWebs = Get-SPWeb -Site $mySite -Limit All $results = @() foreach ($myWeb in $myWebs) { Write-Host "Looking in WEB: " $myWeb.Url -ForegroundColor Green foreach ($myList in $myWeb.Lists) { if ($myList.ContentTypes[0].ResourceFolder.Properties["_ipfs_infopathenabled"] -eq $true) { Write-Host "Found this list using Infopath - " $myList.Title -ForegroundColor Blue $RowDetails = @{ "Site Collection" = $siteCollectionURL "Web" = $myWeb "List Name" = $myList.Title "List URL" = $myList.DefaultViewUrl } $results += New-Object PSObject -Property $RowDetails } } $myFileName = [Environment]::GetFolderPath("Desktop") + "\InfopathDependencyFinder-SiteCollectionScope-" + (Get-Date).ToString('MM-dd-yyyy') + ".csv" $results | export-csv -Path $myFileName -NoTypeInformation } Write-Host "---------------------Completed--------------------------" -ForegroundColor Green } catch { $ErrorMessage = $_.Exception.Message Write-Host $ErrorMessage } |
The key here is the line below,
- $myList.ContentTypes[0].ResourceFolder.Properties[“_ipfs_infopathenabled”] -eq $true
This snippet above checks if the Content Type’s Resource Folder metadata has the InfoPath property – InfoPath Forms Services (_ipfs_infopathenabled) activated on it.
This script runs against site collection, but it can be very easily extended to run across subsite level or even list/library level.
Usage
The script returns the InfoPath lists/libraries below details
- Site,
- Web,
- List/Library Name,
- List/Library URL where the form is deployed
The output is in the form of a CSV file which can be very easily be converted into a .xlsx file for further processing and reporting.
SharePoint 2013 Hosting – HostForLIFE.eu :: Get Site Collection From Web Application
Apr 25th
We can get the subsites under the site using CSOM easily but if we need to get all the site collections under a specific web application from a SharePoint farm, then we can’t get it directly. For that, we have to use SharePoint search. By using SharePoint Search, we set the “KeywordQuery” to filter and get the site collections. Before using the code block, we should ensure that the SharePoint Search Service Application is running and active.
The code block for this is mentioned below.
In this blog, I have explained how you can get all the site Collections under a SharePoint web application. I hope this blog will help you out in a few scenarios.
SharePoint 2013 Hosting – HostForLIFE.eu :: Easy SharePoint ListItem CRUD Operation Using REST API Wrapper
Apr 18th
I have read lots of articles on C# Corner, as well as on other online websites about CRUD operations on Sharepoint List. In most articles, I have found some redundant code which can be reused and utilized in such a way that any new developer or learner can learn from the code.
You might be wondering how to use SPRest for CRUD Operation in SharePoint.
1 |
var spRest=new SPRest("https://brgrp.sharepoint.com") |
- Title -Single line of Text
- UserId – Number
- Completed -Single line of Text
Get All List Items from Sharepoint List
1 2 3 4 5 |
// Get All Item from List item spRest.Utils.ListItem.GetAllItem({listName:"PlaceHolderList"}).then(function(r){ console.log(r); // Response received. TODO bind record to table or somewhere else. }); |
Get List Item from SharePoint List by Id
1 2 3 4 5 |
// Get List Item By Id spRest.Utils.ListItem.GetItemById({listName:"PlaceHolderList",Id:201}).then(function(r){ console.log(r); // Response received. }); |
Add New List Item to SharePoint List
1 2 3 4 5 |
// Add ListItem to Sharepoint List spRest.Utils.ListItem.Add({listName:"PlaceHolderList",data:{Title:"New Item Created For Demo",UserId:1,Completed:"true"}}).then(function(r){ console.log(r); // Added New List item response received with newly created item }); |
Update New List Item By Id in SharePoint List
1 2 3 4 5 |
// Update List item based on ID with new data in SharePoint List spRest.Utils.ListItem.Update({listName:"PlaceHolderList",Id:201,data:{Title:"Updated List Item",UserId:1,Completed:"true"}}).then(function(r){ // List Item Updated and received response with status 204 console.log(r); }); |
Delete New List Item By Id in SharePoint List
1 2 3 4 5 |
// Delete List item based on ID spRest.Utils.ListItem.Delete({listName:"PlaceHolderList",Id:201}).then(function(r){ // List Item Deleted and received response with status 200 console.log(r); }); |
- Generate Request Url Based on Root Site and List Name and Id
- Header accept and Content type
- RequestDigest Headers
- Combined Delete/Update/Add Code with reusable functions to prepare payload data for the request
- Adding and applying metadata for ListItem based on ListName