Wednesday 16 November 2016

Changing the Style in a view of List/Library using powershell

Today I am providing the Power Shell Script that give the report of the style applied on a view and will update the view style as per user choice. To know the details of styles available in view visit this link http://splimitationsbyabhi.blogspot.in/2016/11/view-style-in-sharepoint-listlibrary.html
This script can also be used to update the view style to default using script. 


Inputs
Site collection URl - Where you want to change the style or report will be generated for this site collection only.
List name - Where this change will be applied or report will be generated for the selected list. (Name is case sensitive) (Use Wild card (*) if you want to match a particular string in name like we can use *bp* and you get list of all List that have bp in their names), Alternatively you can use * as input to get the list of all list and library.
View name - Where this change will be applied or report will be generated for the selected View. (Name is case sensitive) (Use Wild card (*) if you want to match a particular string in name like we can use *bp* and you get list of all List that have bp in their names), Alternatively you can use * as input to get the list of all list and library.
Path - Report file path with file name and extension as .csv
Option - Enter R for getting the report of View Style and U for updating the View Style
Styleid - Style Id to be applied if you want to update the Style (Enter d for default) visit http://splimitationsbyabhi.blogspot.in/2016/11/view-style-in-sharepoint-listlibrary.html for style id.

Outputs
A report with applied style will be generated and if user want this script will update the Style in the views.

Example-
.\scriptname.ps1
.\scriptname.ps1 | out-file “FilePath\Filename.txt”

Dependencies –
User should have Site Collection Admin rights for executing this script.
User should have Shell Admin rights to run the scripts.
Run Management Shell as an Administrator. 
How to execute -
Copy this script and paste in Note pad.
Save this file as .ps1.
Run this script in SharePoint Management Shell. You can run this script in PowerShell as well.
Follow on screen instructions.

FOR ANY HELP ON THIS SCRIPT USE "GET-HELP .\SCRIPTNAME.PS1 --FULL" AFTER SAVING THIS FILE.

3 comments:

  1. Dear Abhinav Agarwal,
    I am just searching a powershell script to change the view style to Default. I cannot find the script on this site. How can I get the Powershell Script? Thank you very much for your help!

    ReplyDelete
    Replies
    1. Dear Yue,
      The link to google drive have the script at the end of the blog post. I have copied the link in my comment as well.

      https://drive.google.com/file/d/0BznVpoE_ln0ASjVOQXJfNWhFQW8/view?usp=sharing

      Delete
    2. Now I got it! Thank you very much!

      Delete