SharePoint Online: Change Group Owner using PowerShell

May 29, 2017    , , , ,
SharePoint groups simplifies permission administration by assigning a set of users to a group and assigning permissions to them through the group. When we create a site, The default Owner Group of the site is assigned as Group owner for all groups. If anyone create a custom group, then they'll be assigned as group owner. How to Change the Group Owner in SharePoint Online? Follow these steps to change the owner of a group in SharePoint Online. Go to Site Settings >>  People and Groups Pick the group you want change the group owner from the left navigation From the group page, Click on Settings >> Group Settings  Enter the new group owner in "Group Owner" field. Hit OK to save your changes. This changes owner of a SharePoint Online group. Set Group Owner using SharePoint Online Management Shell: You can use SharePoint Online Management Shell to set the owner of a SharePoint Online group. #Parameters $AdminSiteURL="https://crescent-admin.sha
SharePoint Online: Change Group Owner using PowerShell SharePoint Online: Change Group Owner using PowerShell Reviewed by Salaudeen Rajack on May 29, 2017 Rating: 5

SharePoint Online: Remove Web Part from Page using PowerShell

May 28, 2017    , , ,
Requirement: Remove web part from a page in SharePoint Online using PowerShell How to Delete a Web Part from a SharePoint Online Page? Web parts are the widgets to show information, add business functionality, implement process, act as an interface to databases or provide any other application specific functionality. Web parts on a SharePoint Online page can be removed if they are no longer needed. You can Remove a web part by: Navigate to the page where the web part is placed >> Click on Edit Page from settings menu. From the web part drop-down menu, select the Delete option and confirm the prompt. This removes the web part from the page.   PowerShell to Delete a web part from a Page in SharePoint Online: We have a script editor web part, titled "Google Analytics Script" in SharePoint Online page and got a requirement to remove it using PowerShell. #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Ser
SharePoint Online: Remove Web Part from Page using PowerShell SharePoint Online: Remove Web Part from Page using PowerShell Reviewed by Salaudeen Rajack on May 28, 2017 Rating: 5

Get Content Type Fields using PowerShell in SharePoint

May 28, 2017    , , , ,
Requirement: PowerShell to get content type fields in SharePoint. SharePoint PowerShell to Get Content Type Fields Here is my PowerShell to get a Content Type and its columns, loop through them, and output a CSV file with the following data: Column Title Column Internal Name Column ID Column Group Column Description Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue #Variables for processing $SiteURL = "http://intranet.crescent.com" $ContentTypeName = "Credit Projects" $OutputFile = "C:\Temp\ContentTypes.csv" #Get the Web $Web = Get-SPWeb $SiteURL #Get the Content Type $CType = $Web.ContentTypes[$ContentTypeName] $ResultArray = @() #Loop through the Fields in the Content Type ForEach ($Field in $CType.Fields) { # Create a new custom object to hold our row of data with property names: $Result = New-Object PSObject $Result | Add-Member -MemberType NoteProperty -Name "Title" -Value $field.Title
Get Content Type Fields using PowerShell in SharePoint Get Content Type Fields using PowerShell in SharePoint Reviewed by Salaudeen Rajack on May 28, 2017 Rating: 5

How to Hide a Content Type from New Button Dropdown in SharePoint?

May 27, 2017    , , , ,
Requirement: Hide a Content Type from new button dropdown in SharePoint How to Make a Content Type Hidden in SharePoint? To hide a content type from new menu in SharePoint, Go to List Settings >> Under "Content Types", click on "Change new button order and default content type" link. Set the "Visible" flag to False by un-checking the tick mark. You can also change New Button Order. This hides the content type in SharePoint. SharePoint PowerShell to Hide a Content Type We can also use PowerShell to hide a content type from new menu in SharePoint. Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Set config variables $WebURL="http://intranet.crescent.com/" $ListName ="Projects" $ContentTypeName="Project Template" #Get Web and Objects $Web = Get-SPWeb $WebURL $List = $Web.Lists[$ListName] #Get the content type $ContentType = $List.ContentTypes[$ContentTypeName] $ContentType.Hidd
How to Hide a Content Type from New Button Dropdown in SharePoint? How to Hide a Content Type from New Button Dropdown in SharePoint? Reviewed by Salaudeen Rajack on May 27, 2017 Rating: 5

How to Hide a Field in Content Type using PowerShell?

May 27, 2017    , , , ,
Requirement: Hide content type field in SharePoint list forms How to Hide a Field using Content types in SharePoint? You can hide a column appearing from all forms of the list such as: NewForm.aspx, EditForm.aspx, DispForm.asxp using content type. Follow these steps to hide field in content type. Go to List Settings >> Advanced Settings >> Enable "Allow management of content types"  check the box. Once content types are enabled, you can hide any field of that content type. Go to List Settings again >> Under Content Types Click on Item content type (or whatever content type applicable)  Click on Title column (or the column you wish to hide) under columns group >> Click on Hidden option. This makes the column hidden in the content type. SharePoint: Hide Content Type Field using PowerShell: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Set config variables $WebURL="http://intranet.crescent.com/" $
How to Hide a Field in Content Type using PowerShell? How to Hide a Field in Content Type using PowerShell? Reviewed by Salaudeen Rajack on May 27, 2017 Rating: 5

How to Disable External Sharing in SharePoint Online?

May 25, 2017    , , ,
External sharing in SharePoint Online is a features enables users to share documents and content outside the organization with people who are not members of your organization such as vendors, customers, consultants, etc. For security reasons, we wanted to disable external sharing completely. How to Disable External Sharing in SharePoint Online? To turn off external Sharing in SharePoint Online, follow these steps: Login to SharePoint Online Admin Center as a global admin or SharePoint Online admin. From the left navigation, click on "Sharing" link Under "Sharing outside your organization" section, set the sharing option to "Don't allow sharing outside your organization". Click on "OK" button in the bottom to save your changes. This prevents all users on all sites from sharing sites or sharing content on sites with external users. Disable External Sharing in SharePoint Online using PowerShell: #Set Admin Center URL $AdminCent
How to Disable External Sharing in SharePoint Online? How to Disable External Sharing in SharePoint Online? Reviewed by Salaudeen Rajack on May 25, 2017 Rating: 5

How to Set Multiple Choices as Default Value in SharePoint List?

May 23, 2017    , ,
Requirement: Set more than one choice as default value in a SharePoint list! How to Set Multiple Choices as Default Value in SharePoint List? Choice field in SharePoint allows one single value to set as default value. What if you want to set multiple values as default value? In my case, I wanted multiple check boxes to be enabled by default when user creates new item. Here is how you can set multiple check boxes ticked: When creating the field (or edit the existing field), In Field settings, set the "Default value" to " Calculated Value " option Now, Enter the formula in this format: =";#Choice1;#Choice2;#Choice3;#Choice4;#" , In my case, I wanted to set "Growth Capital" and "Private Investment" choices ticked by default. So my formula was: =";#Growth Capital;#Private Investment;#" This sets the given check boxes (choices) enabled in New item creation (NewForm.aspx)
How to Set Multiple Choices as Default Value in SharePoint List? How to Set Multiple Choices as Default Value in SharePoint List? Reviewed by Salaudeen Rajack on May 23, 2017 Rating: 5

SharePoint Online: Get All Files from a Folder using PowerShell

May 23, 2017    , , , ,
Requirement: SharePoint Online PowerShell to list files in folder. PowerShell to Get Files from Folder in SharePoint Online: Lets retrieve all files from a given folder in SharePoint Online document library using PowerShell. #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" Function Get-FilesFromFolder() { param ( [Parameter(Mandatory=$true)] [string] $SiteURL, [Parameter(Mandatory=$true)] [string] $FolderURL ) Try { #Setup Credentials to connect $Cred = Get-Credential $Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password) #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientC
SharePoint Online: Get All Files from a Folder using PowerShell SharePoint Online: Get All Files from a Folder using PowerShell Reviewed by Salaudeen Rajack on May 23, 2017 Rating: 5

SharePoint Online: PowerShell to Get All Site Collections and Subsites

May 23, 2017    , , , , ,
Requirement: SharePoint online PowerShell to get all site collections and subsites. SharePoint Online PowerShell to list all site collections and subsites Here is the PowerShell to list all site collections and subsites in SharePoint Online. Import-Module Microsoft.Online.SharePoint.Powershell #Config Parameters $AdminSiteURL="https://crescent-admin.sharepoint.com" #Get Credentials to connect to SharePoint Admin Center $Cred = Get-Credential #Function to get all subsites of a site Function Get-SPOWeb($WebURL) { #Setup credentials to connect $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password) #Get Web information and subsites $Context = New-Object Microsoft.SharePoint.Client.ClientContext($webURL) $Context.Credentials = $Credentials $Web = $context.Web $Context.Load($web) $Context.Load($web.Webs) $Context.executeQuery() #Iterate through each subsite in the current
SharePoint Online: PowerShell to Get All Site Collections and Subsites SharePoint Online: PowerShell to Get All Site Collections and Subsites Reviewed by Salaudeen Rajack on May 23, 2017 Rating: 5

How to Backup-Restore a Site Collection in SharePoint using PowerShell?

May 15, 2017    , , , , , ,
Requirement: Backup and restore a site collection in SharePoint 2013 using PowerShell. How to backup a site collection in SharePoint 2013 using PowerShell? Although you can backup site collections from SharePoint Central Administration, as in  How to Backup SharePoint Site Collection using Central Admin , the Central admin way is kind of clunky and takes a while to perform the backup. PowerShell provides a quick and easy way to backup site collections, We can use in scripted operations and avoid manual repetition of same tasks such as performing backups. Use SharePoint 2016 Management Shell to run these cmdlets. SharePoint site collection backups may be initiated from SharePoint WFEs and you need to be member of a local administrator on the server and should be a farm admin. Backup SharePoint Site Collection using PowerShell Here is the PowerShell syntax to take backup of a site collection in SharePoint 2016. It takes two mandatory parameters to identify the site collection to
How to Backup-Restore a Site Collection in SharePoint using PowerShell? How to Backup-Restore a Site Collection in SharePoint using PowerShell? Reviewed by Salaudeen Rajack on May 15, 2017 Rating: 5

Backup SharePoint Site Collection using Central Admin

May 08, 2017    , , , , ,
Requirement: Backup a SharePoint Site Collection using Central Administration Backup Site Collection in SharePoint 2016 Central Admin Site collections can be backed up using SharePoint 2016 Central Administration. To backup a  site collection using Central Administration, follow these steps: Login to SharePoint Central Administration Site >> Click on "Backup and Restore" link in the left navigation. Under Granular Backup, Click on "Perform a Site Collection backup" On the Site Collection Backup page, Select the target site collection to backup. You can switch between web applications and select any site collection in the farm. Set the UNC path to the backup file location. You can also specify any location server location such as "D:\Backup\Sales.bak" Click on "Start Backup" to begin the backup procedure. You'll get backup job status page. Based on the size of your site collection, backup may take time. Wait for the backu
Backup SharePoint Site Collection using Central Admin Backup SharePoint Site Collection using Central Admin Reviewed by Salaudeen Rajack on May 08, 2017 Rating: 5

Rename a File in SharePoint Document Library using PowerShell

May 06, 2017    ,
Requirement: Rename a File in SharePoint document library using PowerShell. PowerShell to Rename a File in SharePoint: Lets rename a file with ID "4" in "Documents" SharePoint library. Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue #Variables for processing $WebURL = "http://intranet.crescent.com" $ListName = "Documents" $ItemID ="4" $NewFileName="sharepoint databases.pptx" #Get Web, List and Item $Web = Get-SPWeb $WebURL $List = $Web.Lists[$ListName] $ListItem = $List.GetItemByID($ItemID) #Check-out and Rename the file $ListItem.File.CheckOut() $ListItem["Name"] = $NewFileName $ListItem.Update() $ListItem.File.CheckIn("File has been renamed!") Instead of Item ID, Lets use the existing file name and rename it. Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue #Variables for processing $WebURL = "http://intranet.crescent.com" $ListNam
Rename a File in SharePoint Document Library using PowerShell Rename a File in SharePoint Document Library using PowerShell Reviewed by Salaudeen Rajack on May 06, 2017 Rating: 5
Powered by Blogger.