Skip to main content

Posts

Showing posts with the label Powershell

Add Items to sharepoint online List using powershell!!

SharePoint online provides only a small set of basic commands for writing powershell scripts. IF we have to do any operation using powershell we need to use CSOM or REST API.   Sharepoint patterns and Practises (PnP) team came with a powershell module for doing operation on the sharepoint online. Its very help full while writing scripts.   Similar modules exists for Sharepoint 2013 and Sharepoint 2016.   Link to the Github respositry. In the below article I will try to add items to a list picking the data from the JSON file.           Try to check whether SharepointPNPPowershellOnline module was installed or not. If not install it. # This script adds items to the list picking up the data from the json file. if (-not (Get-Module -ListAvailable -Name SharePointPnPPowerShellOnline)) { Install-Module SharePointPnPPowerShellOnline }           Get the data from the json file and store it in a va...

Finding out the list of documents/items modified in last one day in SharePoint using power shell

Recently i was working for a government project where the requirement is to track the documents which are modified today. Power shell came to our rescue. The script is simple we will iterate through all the documents in a library and compare the last modified date with today's date. If last modified date is greater than today,s  date then the document is modified today. This script is run daily end of the day using the scheduler, the captured data is written into a CSV file and saved to a local folder. Power shell script The list of sites can be fetched from a CSV file also. The captured data can also via an email using send-mail power shell command. Hope this is helpful to someone.

Finding the lock status of a site collection using powershell

When a backup job is running or a patch installation on the SharePoint server there is a possibility of getting site collection getting locked due to backup job failure or for some other reason. When the users try to update anything it throws an error which will result in raising a ticket. This all can be avoided by using power shell and scheduler. Powershell for removing the lock on the site collection. Lock is applied at a site collection level. The above script will check the different lock on the site collection and remove it. Send a mail to the admin that the lock is removed.  The list of webapplication is taken from a CSV file. Hope this is helpful..

Creating a map view from the SharePoint UI using the Geo location field.

There are two parts for creation of map view in SharePoint using Geo location field. Generating a valid Bing maps key. Creation of a Geo location field and list for showing the map view. 1. Generating a valid Bing maps key Bing map key is a sort of license key. It makes sure that you are registered with Bing maps portal and not using Bing maps for free. There is a 90 days trail version which we can use for development. Register into the Bing maps portal  and copy the a valid key. Now run the below powershell script for setting the Bing map key into sharepoint. Key can be set at farm level and web level. At farm level it can be set using powershell, at web level it needs to set using CSOM(Client side object model). Setting of bing map key at web level has high priority than setting at farm level.  Set-SPBingMapsKey -BingKey "" 2. Creation of a Geo location field and list for showing the map view In the second part we need to create the geo location f...

Creation of Sub Sites using powershell with CSV file as input SharePoint

Creation of sites is a boring process when we are setting up a SharePoint environment. We can use power shell script for automating this process. I have developed a small power shell script for doing this. Powershell Script The format for the CSV is shown below. CSV file format Please make sure that you create the root site collection. we can include that part also in the script. Please find the script file here .