kwizcom banner advertisement

Export SharePoint List Data to SQL Server Table using PowerShell

June 26, 2016    , , , , ,
Requirement: For an in-house built business intelligence tool, had a requirement to export SharePoint list data into SQL Server table. As directly querying SharePoint content databases is not supported by Microsoft and it also could cause performance issues to your SharePoint farm - Lets not think about it further! Of course, there are 3rd party products available on the market to do this, however PowerShell can be utilized to fulfill this requirement. This PowerShell script retrieves given SharePoint List(s), iterate through all available fields and dynamically creates SQL Server Table and then inserts the data after translating it, and inserts into the SQL Server database table. Here is my PowerShell script to Convert SharePoint list into SQL Server table and extract data from SharePoint to SQL: PowerShell Script to Extract SharePoint List Data into SQL Server Table: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue Function Create-List2Table($Li
Export SharePoint List Data to SQL Server Table using PowerShell Export SharePoint List Data to SQL Server Table using PowerShell Reviewed by Salaudeen Rajack on June 26, 2016 Rating: 5

SharePoint Online: Empty Recycle Bin using PowerShell

June 24, 2016    , , ,
Requirement: Empty recycle bin in SharePoint Online using PowerShell. To clear SharePoint online recycle bin at site level, follow these steps: Navigate to your SharePoint online site, Click on Site Settings Gear >> Choose "Site Contents" From the All site contents page, click on "Recycle Bin" link Select all items and click on "Delete Selection" link to delete items from recycle bin in SharePoint online. This moves items to second stage recycle bin. If you have Site collection Admin rights, you can use Recycle bin link at Site Settings >> Recycle bin (Under Site collection Administration) to access deleted items of all users and second stage recycle bin.  SharePoint Online: Empty Recycle bin using PowerShell Here is the PowerShell to empty recycle bin in SharePoint online. #Load SharePoint Online Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.C
SharePoint Online: Empty Recycle Bin using PowerShell SharePoint Online: Empty Recycle Bin using PowerShell Reviewed by Salaudeen Rajack on June 24, 2016 Rating: 5

Add Site Collection Administrator to All Sites in SharePoint using PowerShell

June 21, 2016    , , , , , ,
Site collection administrators have God like power within a Site Collection in SharePoint 2016. Apart from Primary & Secondary site collection administrators, we can add additional site collection administrator on any SharePoint site collection. How to Add a Site Collection Administrator in SharePoint 2016? To Add a Site Collection Administrator follow these steps: Site Settings Gear >> Click on "Site Settings" Menu Item Click on "Site collection administrators link under "Users and Permissions" Enter the New user in Site Collection Administrators Field. Click OK to save your changes. OK! Now, How about adding a same user as administrator in all site collections? PowerShell Script to Add a Site Collection Administrator to All Site Collections in SharePoint: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #User Account to add as Site Collection Admin $UserAccount="Crescent\Salaudeen" Get-SPSite -Lim
Add Site Collection Administrator to All Sites in SharePoint using PowerShell Add Site Collection Administrator to All Sites in SharePoint using PowerShell Reviewed by Salaudeen Rajack on June 21, 2016 Rating: 5

Fast Site Creation in SharePoint 2016

June 21, 2016    ,
Fast Site Creation is a new feature introduced in SharePoint 2016. As the name suggests, Fast site Creation helps to speed up the site collection creation process. Internally, site collections are copied at at SQL Server content database level, instead of calling traditional object model calls. Typically, this helps any large organization or multi-tenant environments to create site collections faster by mitigating feature activation overhead. Here are the steps for SharePoint 2016 fast site collection creation. Step 1: Enable Fast site creation for SharePoint Site Template As a first step, we've to enable Fast site creation on a SharePoint site template. Lets enable for team site template. Enable-SPWebTemplateForSiteMaster -Template "STS#0" -CompatibilityLevel 15 To get all site templates with fast site creation enabled, use the cmdlet: Get-SPWebTemplatesEnabledForSiteMaster To Disable fast site creation for a site template, use the cmdlet: Disable-SPWebTempla
Fast Site Creation in SharePoint 2016 Fast Site Creation in SharePoint 2016 Reviewed by Salaudeen Rajack on June 21, 2016 Rating: 5

How to Restore Previous Document Version in SharePoint 2016 using PowerShell?

June 18, 2016    , , ,
Version history feature in SharePoint enables us to track changes and revert to old versions when turned ON. Any changes made in SharePoint online list item or document, creates new version. There are scenarios you could run into, where you have to roll back to an older version of document. All you have to do is select a version from the version history and simply restore.   How to Restore a previous document version in SharePoint? Go to your document library and click and Right click on the document name and date, and then click Version History from the menu.  You'll see a list of versions of the file. Hover your mouse over the Modified date column of the version you want to recover. Click on the arrow to get the menu. Click "Restore" from the version history menu and the confirm by clicking "OK" button. This creates a new version from the previous version you choose. Please note, You may have to "Check Out" prior to restoring the docu
How to Restore Previous Document Version in SharePoint 2016 using PowerShell? How to Restore Previous Document Version in SharePoint 2016 using PowerShell? Reviewed by Salaudeen Rajack on June 18, 2016 Rating: 5

SharePoint Online: Add Column to List Content Type using PowerShell

June 18, 2016    , , , , ,
Requirement: Add field to list content type in SharePoint Online. How to Add a column to a List or Library Content type in SharePoint Online? If you want to add a field to list or library's content type, follow these steps: Go to the list or library settings >> Click on the appropriate content type name from List settings page. In List Content Type page, under columns section, click on "Add from existing site or list columns" link Select the appropriate column group and then select the column you want to add to content type, Click on "Add" button and then OK to add that column to your content type. You can add column either from the existing list's columns or from site columns. SharePoint Online: PowerShell to Add Field to List Content Type Lets add field to list content type using PowerShell. #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.Sh
SharePoint Online: Add Column to List Content Type using PowerShell SharePoint Online: Add Column to List Content Type using PowerShell Reviewed by Salaudeen Rajack on June 18, 2016 Rating: 5

SharePoint Online: Change Welcome Page using PowerShell

June 18, 2016    , ,
How to change welcome page in SharePoint Online? To set welcome page in SharePoint online, Navigate to: Site Settings  >> Click on "Welcome page" under Look and Feel Use browse or directly type any any existing page in the site to change the welcome page.  Click OK to save your changed. PowerShell to change welcome page SharePoint Online: Use this PowerShell script to change welcome page of a sharepoint online site. #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" #Set Variables for Site URL $SiteURL= "https://crescent.sharepoint.com/sites/sales/" $WelcomePage="SitePages/Default.aspx" #Relative path to site #Setup Credentials to connect $Cred = Get-Credential $Cred = New-Ob
SharePoint Online: Change Welcome Page using PowerShell SharePoint Online: Change Welcome Page using PowerShell Reviewed by Salaudeen Rajack on June 18, 2016 Rating: 5

SharePoint Online: Add Content Type to List or Library using PowerShell

June 17, 2016    , , , ,
Requirement: SharePoint Online PowerShell to add content type to library. SharePoint Online add content type to list  Assuming you have the content type already created, here are the steps to add content type to list in SharePoint online: Step 1: Enable content types management for the list, if its not enabled already Navigate to the List settings >> Click on "Advanced Settings" link under General Settings Set "Yes" for "Allow management of content types?" option and hit OK button in the bottom of the page to save your changes. Step 2: Add Content Type to List or Library Once content types are enabled, here is how you can add content type to list or library in SharePoint Online: Go to the list settings page again, You'll find "Content Types" group created with the default content type listed (E.g. You'll find "Item" content type listed for custom lists). Click on "Add from existing site content types&q
SharePoint Online: Add Content Type to List or Library using PowerShell SharePoint Online: Add Content Type to List or Library using PowerShell Reviewed by Salaudeen Rajack on June 17, 2016 Rating: 5

Fix "Unable to render the data. If the problem persists, contact your web server administrator." Issue in SharePoint BCS

June 14, 2016    , , ,
Problem: Tried created an external list SharePoint 2016 using business data connectivity services, configured secure store target application and created external list in SharePoint. All went good, however the external list displayed this error message with a correlation ID. Unable to render the data. If the problem persists, contact your web server administrator. Ran ULS Log viewer and found this message in the logs: Error while executing web part: Microsoft.BusinessData.Infrastructure.BdcException: The shim execution failed unexpectedly - Unable to obtain the application proxy for the context.. ---> Microsoft.Office.SecureStoreService.Server.SecureStoreServiceException: Unable to obtain the application proxy for the context.     Solution: The root cause of the problem is: The web application is not associated with the secure store service application. So, the solution is : Go to SharePoint 2013/2016 Central Administration site Application management >> Click on C
Fix "Unable to render the data. If the problem persists, contact your web server administrator." Issue in SharePoint BCS Fix "Unable to render the data. If the problem persists, contact your web server administrator." Issue in SharePoint BCS Reviewed by Salaudeen Rajack on June 14, 2016 Rating: 5

Create Bulk Alerts from CSV File in SharePoint using PowerShell

June 12, 2016    , , ,
Requirement: Create alerts on bunch of libraries in different site collections of a SharePoint Web application! Solution: Identified and exported list of Sites and Document Library names in the CSV file and used this PowerShell script to create multiple alerts. PowerShell script to crate bulk alerts from CSV File: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Function to Create alert on Given List to given users Function Create-Alert([Microsoft.SharePoint.SPList]$List,[Microsoft.SharePoint.SPUser]$User) { $newAlert = $user.Alerts.Add() $newAlert.Title = "Minitoring Alert for: "+$List.Title $newAlert.AlertType=[Microsoft.SharePoint.SPAlertType]::List $newAlert.List = $List $newAlert.DeliveryChannels = [Microsoft.SharePoint.SPAlertDeliveryChannels]::Email $newAlert.EventType = [Microsoft.SharePoint.SPEventType]::Add $newAlert.AlertFrequency = [Microsoft.SharePoint.SPAlertFrequency]::Immediate $newAlert.Updat
Create Bulk Alerts from CSV File in SharePoint using PowerShell Create Bulk Alerts from CSV File in SharePoint using PowerShell Reviewed by Salaudeen Rajack on June 12, 2016 Rating: 5

SharePoint Online: Deactivate Feature using PowerShell

June 08, 2016    , , , ,
Requirement: Deactivate a feature in SharePoint online using PowerShell. SharePoint Online PowerShell to disable feature: Here is how to disable a SharePoint Online feature using the Client Side Object Model and PowerShell.  #Load SharePoint Online CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" #Function to Disable Feature in SharePoint Online Function Disable-SPOFeature { param ($SiteCollURL,$UserName,$Password,$FeatureGuid) Try { #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteCollURL) $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $Password) $Ctx.Credentials = $Credentials $Site=$Ctx.Site
SharePoint Online: Deactivate Feature using PowerShell SharePoint Online: Deactivate Feature using PowerShell Reviewed by Salaudeen Rajack on June 08, 2016 Rating: 5

SharePoint Online: PowerShell to Get Site Collection Administrators

June 06, 2016    , , , ,
SharePoint site collection administrators possess full control to the entire site collection - including top-level site, subsites and all lists and libraries in the site collection. Each SharePoint 2016 site collection can have its own Site Collection Administrators, Typically assigned during the time of site collection is creation by SharePoint Online administrators through SharePoint Online Admin Center site as Primary and secondary site collection owners. Additional site collection administrators can be added/removed through site collection settings page. Site collection administrators have same access rights as same as primary or secondary site owners but the only difference is: E-mail notifications! Primary and secondary site collection administrators are those who'll be getting Email notifications such as site collection storage limit warning Emails. How to Get site collection administrators in SharePoint Online? If you want to get all site collection administrators,
SharePoint Online: PowerShell to Get Site Collection Administrators SharePoint Online: PowerShell to Get Site Collection Administrators Reviewed by Salaudeen Rajack on June 06, 2016 Rating: 5

SharePoint Online: PowerShell to Add User to Group

June 05, 2016    , , , ,
Requirement: Add user to group in SharePoint online using PowerShell. Prerequisites: You need to have SharePoint online Management Shell installed in your client machine! Solution: SharePoint Online PowerShell to add user to group To add an individual user to SharePoint online site collection group using PowerShell, use Add-SPOUser cmdlet from SharePoint online management shell. Here is an example: Step 1: Enter the connection Credentials for SharePoint Online Admin Center $Credential = Get-credential This prompts for user name and password. Key-in your SharePoint online Administrator credentials. Step 2: Connect to SharePoint Online Service: Connect-SPOService -url https://Crescent-admin.sharepoint.com -Credential $Credential Step 3: Add User to SharePoint Online Site Group: Once the connection is established successfully in the previous step, you can add user to group. Add-SPOUser -Site "https://Crescent.sharepoint.com/sites/Sales" -Group "Sales Me
SharePoint Online: PowerShell to Add User to Group SharePoint Online: PowerShell to Add User to Group Reviewed by Salaudeen Rajack on June 05, 2016 Rating: 5

Create Site Collections in Bulk from a CSV File using PowerShell in SharePoint 2016

June 05, 2016    , , , , ,
PowerShell cmdlet New-SPSite is used to create new site collections in SharePoint. It takes URL and Owner mandatory parameters with other parameters. Here is an example: Create SharePoint Site Collection Using PowerShell : Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Parameters to create new site collection $SiteName = "Demo" $SiteURL= "http://intranet.Crescent.com/sites/demo" $SiteOwner = "Crescent\SPAdmin" $SiteTemplate = "STS#0" #create site collection with given parameters New-SPSite -Url $URL -Name $SiteName -OwnerAlias $SiteOwner -Template $SiteTemplate PowerShell to Create Multiple Site Collections in Bulk from a CSV File: Lets add some error handling and wrap New-SPSite into a reusable PowerShell function, to create multiple site collections from a CSV file. Step 1: Create a CSV file in the below format. Populate the column values according to your requirements. Step 2: Use this PowerShell
Create Site Collections in Bulk from a CSV File using PowerShell in SharePoint 2016 Create Site Collections in Bulk from a CSV File using PowerShell in SharePoint 2016 Reviewed by Salaudeen Rajack on June 05, 2016 Rating: 5

SharePoint Online: Upload Files to Document Library using PowerShell

June 04, 2016    , , ,
Requirement: Upload files to SharePoint online using PowerShell. How to Upload a File to SharePoint Online Document Library using PowerShell: Lets upload a document using PowerShell in SharePoint Online. Here is how to upload files to SharePoint online. #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" #Variables for Processing $WebUrl = "https://crescent.sharepoint.com/Sites/Sales/" $LibraryName ="Documents" $SourceFile="C:\SitesToCreate.csv" $AdminName ="Salaudeen@crescent.com" $AdminPassword ="password goes here" #Setup Credentials to connect $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($AdminName,(ConvertTo-SecureString $Admin
SharePoint Online: Upload Files to Document Library using PowerShell SharePoint Online: Upload Files to Document Library using PowerShell Reviewed by Salaudeen Rajack on June 04, 2016 Rating: 5

SharePoint Online: How to Create New Site Collection using PowerShell?

June 04, 2016    , , ,
Requirement: Create a site collection in SharePoint online using PowerShell! How to Create a Site Collection in SharePoint Online? Site collection in SharePoint is a logical group sites with a common top-level site and/or zero or more subsites organized as a hierarchy. Every site collection share common top site, navigation, security, content types, etc. To create a SharePoint Online Site collection from Browser, follow these steps: Login to SharePoint Admin Center as a tenant admin or SharePoint Online Administrator.  Click on "Site Collections" from left navigation >> Click on "New" >> and then "Private Site collection" to create a new site collection. The New Site Collection page appears. Set properties according to your requirement to create site collection. Such as:  Title and description for your new site,  Site Address (URL path) for the site Select the Template for your site collection, typically "Team Site" will do
SharePoint Online: How to Create New Site Collection using PowerShell? SharePoint Online: How to Create New Site Collection using PowerShell? Reviewed by Salaudeen Rajack on June 04, 2016 Rating: 5

How to Hide a Field in InfoPath New Form of SharePoint List?

June 01, 2016    , ,
Requirement: We have a customized InfoPath form for a SharePoint List with "Request Number" field, which gets updated by an event receiver (or workflows sometimes) on Item created event. So, we wanted to hide the "Request Number" field from New Form. Solution: In high level, Insert a "section" control and move the field you want to hide inside to it. Add a formatting rule to hide that section with condition "ID is blank"! ID will be always blank on new forms! Important: You need to have InfoPath Designer installed in your client machine! Hide Fields in New Form of the InfoPath-SharePoint List form: Here is how to hide a field in New Form, step by step: Navigate to your SharePoint list, Click on Customize Form from the List Tab. (Or you can open InfoPath Designer, New >> SharePoint List >> Design Form >> Provide the URL of SharePoint site , and run through the wizard) Insert a New row to the appropriate place in
How to Hide a Field in InfoPath New Form of SharePoint List? How to Hide a Field in InfoPath New Form of SharePoint List? Reviewed by Salaudeen Rajack on June 01, 2016 Rating: 5
Powered by Blogger.