SharePoint Online: Export-Import Content Type using PowerShell

February 28, 2018    , , , ,
Requirement: Export-Import Content Types in SharePoint Online using PowerShell Export Content Type in SharePoint Online using PowerShell: When you want to re-use a content type in different site SharePoint Online site collections, without content type hub, You can copy-paste them using this PowerShell script. #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 to Export the Content Type in SharePoint Online using powershell Function Export-SPOContentType { param ( [string]$SiteURL = $(throw "Enter the Site URL!"), [string]$ContentTypeName = $(throw "Enter the Content Type Name!"), [string]$ExportFile = $(throw "Enter the File to Export!") ) T
SharePoint Online: Export-Import Content Type using PowerShell SharePoint Online: Export-Import Content Type using PowerShell Reviewed by Salaudeen Rajack on February 28, 2018 Rating: 5

SharePoint Online: Get List Content Types using PowerShell

February 27, 2018    , , ,
Requirement: Get All List Content Types in SharePoint Online SharePoint Online List Content Types To get all content types of a  SharePoint List or library, go to List Settings, and you'll find all content types of the list SharePoint Online: PowerShell to Get List Content Types #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 parameter values $SiteURL="https://crescenttech.sharepoint.com/" $ListName="Projects" #Get Credentials to connect $Cred= Get-Credential #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password) #Get the List $L
SharePoint Online: Get List Content Types using PowerShell SharePoint Online: Get List Content Types using PowerShell Reviewed by Salaudeen Rajack on February 27, 2018 Rating: 5

How to Find Who Created a Site in SharePoint?

February 16, 2018    , ,
Ever wanted to find out who has created a SharePoint site? Sorry! There is no way from SharePoint user Interface to get who created a site! You can't get "Created By" or "Created On" values anywhere. But PowerShell is our rescuer! Lets see who has created a SharePoint site using PowerShell: Find Out Who Created a SharePoint Site Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Get the Web $web = Get-SPWeb "http://portal.crescent.com/sites/Sales" #Get Site Creator and Created Date write-host "Site Created by:"$web.Author Write-host "Created on:" $web.Created This PowerShell gets you who created a site collection or subsite. SharePoint Online: PowerShell to Get Who Created Site  Similarly, to find who created a site in SharePoint Online, use this PowerShell script: #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\
How to Find Who Created a Site in SharePoint? How to Find Who Created a Site in SharePoint? Reviewed by Salaudeen Rajack on February 16, 2018 Rating: 5

SharePoint Online: How to Trigger Full Reindex using PowerShell?

February 14, 2018    , , , , ,
Requirement: Reindex SharePoint Online site using PowerShell How to Reindex the SharePoint site? After mapping a crawled property to new managed property in SharePoint Online, We had to Reindex the SharePoint Online site. Typically, whenever you do changes to the search schema, You should Reindex the site. Unlike SharePoint On-premises, where we use Search Service application to trigger a full crawl, We can't force a full crawl through the admin user interface in SharePoint Online. Instead, we've to go to each site and manually trigger the crawl to accomplish the same task. Go to Site Settings >> Under "Search" heading, Click on Search and Offline Availability On Search and offline Availability page, Under Reindex section, click on the "Reindex" button and confirm the prompt. Please note, We don't have any control over the crawl schedules! SharePoint Online targets between 15 minutes and an hour for the time between upload and availabi
SharePoint Online: How to Trigger Full Reindex using PowerShell? SharePoint Online: How to Trigger Full Reindex using PowerShell? Reviewed by Salaudeen Rajack on February 14, 2018 Rating: 5

How to Disable OneDrive for Business in Office 365-SharePoint Online?

February 13, 2018    , ,
Requirement: For Security reasons and to take more control over what users are saving to OneDrive, The organization wanted to disable OneDrive for Business in Office 365. Typically, Office 365 services can be enabled or disabled through managing license for products in Office 365 Admin center, E.g. If you don't want your users to access "Teams" you can simply turn-off Teams license for any user/group. However, there is no way to disable OneDrive license for a user since its clubbed with SharePoint Online license. While its possible to turn off SharePoint Online license, that doesn't serve our purpose.  How to Disable OneDrive for Business for All Users?  Here is how to disable OneDrive completely in office 365. Go to SharePoint Admin Center >> Click on "User Profiles" from left navigation >> Click on "Manage User Permissions" link under "People" group This opens the permissions popup for user profiles service. By def
How to Disable OneDrive for Business in Office 365-SharePoint Online? How to Disable OneDrive for Business in Office 365-SharePoint Online? Reviewed by Salaudeen Rajack on February 13, 2018 Rating: 5

SharePoint Online: Find All Documents using Keyword Query PowerShell

February 13, 2018    , , , ,
Requirement: Get All Documents in SharePoint Online Site and Export to CSV PowerShell to Find All Documents using Keyword Query in SharePoint Online User wants to get a list of all documents which are not updated in recent years. So, Here is the PowerShell script to get all documents in a SharePoint Online site collection sorted by "Last modified Date". #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" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Search.dll" #Config Variables $SiteURL="https://crescenttech.sharepoint.com/" $SearchQuery= "path:https://crescenttech.sharepoint.com AND IsDocument:true AND (NOT File
SharePoint Online: Find All Documents using Keyword Query PowerShell SharePoint Online: Find All Documents using Keyword Query PowerShell Reviewed by Salaudeen Rajack on February 13, 2018 Rating: 5

How to Delete Drop Off Library in SharePoint 2016?

February 11, 2018    , ,
Problem: When content organizer feature is enabled, it creates "Drop Off Library" document library in your SharePoint site. But disabling the feature does not remove the library! Also you can't simply delete "Drop Off Library" because the "Delete this document library" link is not available when you go to "Library Settings". What is Drop off Library in SharePoint? Drop off library with content organizer feature is basically a way to set up one folder for users to upload files to and it will automatically route the files to the appropriate locations that you have configured using content organizer rules. How to Delete drop off Library in SharePoint 2016? To remove the drop off library SharePoint, you have to turn ON "AllowDeletion" flag of the library using Object model (using PowerShell, C#, SharePoint Manager Tool, etc) #Get the web $Web = Get-SPWeb "http://intranet.crescent.com/sales" #Get Drop off libr
How to Delete Drop Off Library in SharePoint 2016? How to Delete Drop Off Library in SharePoint 2016? Reviewed by Salaudeen Rajack on February 11, 2018 Rating: 5

How to Copy a SharePoint List using PowerShell?

February 10, 2018    , , , , , ,
Requirement: Copy a SharePoint List to Another List How to copy a list in SharePoint? While Export-Import is an option, You can save the list with or without content as a template and create any number of new list or libraries from the list template. Go to the list settings and save list as template and then create a new list, pick the list template! PowerShell to Clone a List in SharePoint Here is the PowerShell to copy SharePoint list structure using "Save List as Template" and "Create List from Template" methods. Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Parameters $SiteURL="http://intranet.crescent.com" $ListName="Projects" $NewListName = "Projects Archive" $SaveData= $False Try { #Get the web and List $Web = Get-SPWeb $SiteURL $List = $Web.Lists[$ListName] #Check if the new list doesn't exists If($Web.Lists.TryGetList($NewListName) -eq $null) { #S
How to Copy a SharePoint List using PowerShell? How to Copy a SharePoint List using PowerShell? Reviewed by Salaudeen Rajack on February 10, 2018 Rating: 5

SharePoint Online: Get Site Owner using PowerShell

February 08, 2018    , ,
Requirement: Get SharePoint Online Site Owner using PowerShell How to Identify Site Owner in SharePoint Online? You can find site owner SharePoint Online from SharePoint Online Admin Center. Sign in to SharePoint Online Admin Center (https://YourDomain-admin.sharepoint.com/_layouts/15/online/SiteCollections.aspx) Select the site collection you wish to get site owner from the site collections list >> From the ribbon, Click on "Owners" and then "Manage Administrators.  On the "Manage Administrators" dialog box, You'll get the site owner or primary site collection administrator. PowerShell to Get Site Owner in SharePoint Online: Here is the SharePoint Online PowerShell to list site owners #Variables for Admin Center & Site Collection URL $AdminCenterURL = "https://crescenttech-admin.sharepoint.com/" $SiteURL = "https://crescenttech.sharepoint.com/sites/marketing" #Connect to SharePoint Online Connect-SPOService -u
SharePoint Online: Get Site Owner using PowerShell SharePoint Online: Get Site Owner using PowerShell Reviewed by Salaudeen Rajack on February 08, 2018 Rating: 5

SharePoint Online: How to Change Site Owner using PowerShell?

February 07, 2018    , , ,
Requirement: Change Site Owner in SharePoint Online using PowerShell How to Change Site Owner in SharePoint Online? Site Owners of a SharePoint Online site collections can be changed only through SharePoint Online Admin Center or PowerShell. To change site owner in SharePoint Online follow these steps: Important: You must be either Global Administrator or SharePoint Online Administrator to change site owners in SharePoint Online! Sign in to Office 365 Admin Center ( https://portal.office.com/ ), Click on "SharePoint Admin Center" link from "Admin Centers" section.  You'll be landing to Site Collections list in SharePoint Admin center (https://YourDomain-admin.sharepoint.com/_layouts/15/online/SiteCollections.aspx) with all site collections listed.  Select the site collection from the list of site collections to which you want to change the site owner >> From the ribbon, Click on "Owners" and then "Manage Administrators" On th
SharePoint Online: How to Change Site Owner using PowerShell? SharePoint Online: How to Change Site Owner using PowerShell? Reviewed by Salaudeen Rajack on February 07, 2018 Rating: 5

SharePoint Online: Set Default View using PowerShell

February 07, 2018    , , , ,
Requirement: Change default view in SharePoint Online. How to Change Default View in SharePoint Online? To set a custom list view as default view in SharePoint Online, Go to List Settings >> Scroll down to the bottom and Click on the view name you wish to set as default view under "Views" section In the Edit view page, Check the box next to "Make this the default view" and Click OK to save your changes. So next time, when you hit: https://crescenttech.sharepoint.com/Lists/Projects/, you'll be taken in to the default view "Active Projects" at: https://crescenttech.sharepoint.com/Lists/Projects/Active%20Projects.aspx Tips: In Modern Experience, We can use "Set Current View as Default" in Views Drop-down! SharePoint Online: Set Default View using PowerShell Here is the PowerShell script to change default view in SharePoint Online. #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microso
SharePoint Online: Set Default View using PowerShell SharePoint Online: Set Default View using PowerShell Reviewed by Salaudeen Rajack on February 07, 2018 Rating: 5

How to Change the Document Template in SharePoint Document Library?

February 07, 2018    , , , ,
Requirement: Change document template in SharePoint document library. How to Add New Document Template in SharePoint? To add a document template in SharePoint document library, we've to first Upload a new document template to SharePoint and then Change the document template URL of the SharePoint document library from Document Library Settings >> Advanced Settings. PowerShell to upload a new document template SharePoint: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Parameters $SiteURL="http://intranet.crescent.com" $DocumentLibraryName="Invoices" $DocumentTemplatePath="C:\Docs\Crescent Invoice Template V3.docx" Try { #Get the Web and document Library $Web = Get-SPWeb $SiteURL $DocumentLibrary = $Web.Lists.TryGetList($DocumentLibraryName) #Check Cotent type and document template exists If($DocumentLibrary -ne $null -and [System.IO.File]::Exists($DocumentTemplatePath)) { #G
How to Change the Document Template in SharePoint Document Library? How to Change the Document Template in SharePoint Document Library? Reviewed by Salaudeen Rajack on February 07, 2018 Rating: 5

Add Document Template to Content Type in SharePoint using PowerShell

February 07, 2018    , ,
Requirement:  Associate document template with content type in SharePoint PowerShell to add document template to content type in SharePoint Here is the PowerShell to upload document template to content type in SharePoint. Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Parameters $SiteURL="http://intranet.crescent.com" $ContentTypeName="Crescent Invoice Template V2" $DocumentTemplatePath="C:\Temp\Crescent Invoice Template V3.docx" Try { #Get the Web and Content Type $Web = Get-SPWeb $SiteURL $ContentType = $Web.ContentTypes | Where {$_.Name -eq $ContentTypeName} #Check Cotent type and document template exists If($ContentType -ne $null -and [System.IO.File]::Exists($DocumentTemplatePath)) { #Get the Template File $TemplateFile =(Get-ChildItem $DocumentTemplatePath).OpenRead() #Get the Template File Name $DocumentTemplateFileName = [System.IO.Path]::GetFileName($DocumentTe
Add Document Template to Content Type in SharePoint using PowerShell Add Document Template to Content Type in SharePoint using PowerShell Reviewed by Salaudeen Rajack on February 07, 2018 Rating: 5

How to Add Document Template to Content Type in SharePoint?

February 07, 2018    , , ,
Requirement:   Add document template to content type in SharePoint. How to Associate a Document template with content type: Content type with document template helps to enforce consistency and save time on SharePoint document management. With document templates, users who create new documents based on a content type can have a pre-populated starting point (instead of a blank document). So, the idea is to create a template with desired format and bind it with a content type and then use that content type wherever required. For example, Invoice prepared by various departments of the organization can be standardized by creating a "Invoice" content type and add a Invoice document template with it. To add document template to content type follow these steps: Upload Document Template to Content Type Prepare and save a document (E.g. Microsoft Word document) locally with your desired formatting for new documents based on this template Go to your SharePoint site and click on
How to Add Document Template to Content Type in SharePoint? How to Add Document Template to Content Type in SharePoint? Reviewed by Salaudeen Rajack on February 07, 2018 Rating: 5

SharePoint Online: "Delete this Document Library" is Missing

February 06, 2018    ,
Problem: Cannot delete a SharePoint Online document library as "Delete this Document Library" option is missing in document library settings! Tried deleting the library from site contents page, library's ribbon menu, SharePoint Designer, Content and structure tool, Explorer view, PowerShell but none of them helped! Solution: You may not see "Delete this list" option if you don't have "Edit" or more access rights in SharePoint Online site! Also, in some of the system libraries "Allow Deletion" flag is set to FALSE to prevent the library from accidental deletions. (E.g. in "Farm Templates", "Style Library", etc Delete this Document Library link is missing by default to prevent delete). How to Enable delete in a SharePoint Online Document Library? Use this PowerShell to enable Delete in a library by setting "Allow Deletion" flag to True! #Load SharePoint CSOM Assemblies Add-Type -Path "C:\
SharePoint Online: "Delete this Document Library" is Missing SharePoint Online: "Delete this Document Library" is Missing Reviewed by Salaudeen Rajack on February 06, 2018 Rating: 5

SharePoint Online: Delete User from User Information List

February 04, 2018    , ,
Problem: Deleted user accounts still appears in SharePoint Online People Picker! Need to remove user from user information list! Root Cause : When a SharePoint Online user browse to a site, SharePoint creates an entry in "User information List" to cache the user information. SharePoint syncs this list from user profile when user create/edit/update/delete items. When the user is deleted in Office 365 Azure AD, their related entry in UserInfo list is not removed. How to Delete User from User Information List in SharePoint Online? To delete a user from user information list, follow these steps: Navigate to the URL in the browser to: https://YourDomain.sharepoint.com/_layouts/15/people.aspx?membershipGroupId=0 This takes you to the "All People" View. Now you can select and remove users from this User Information List by Clicking on Actions >> Delete User from Site Collection, and then confirm the prompt. This deletes user from user information list
SharePoint Online: Delete User from User Information List SharePoint Online: Delete User from User Information List Reviewed by Salaudeen Rajack on February 04, 2018 Rating: 5

How to Change a Group Name in SharePoint Online?

February 03, 2018    , , , ,
Requirement: Change Group Name in SharePoint Online SharePoint Online: Change Group Name To rename a SharePoint Online user group, Navigate to: Site settings >> Site permissions >> Click on the group name On the group page, Click on the "Group Settings" from Settings Menu Provide a name for your SharePoint Online group. Click on OK to save your changes. Rename Group in SharePoint Online using PowerShell You can renaming a SharePoint group using PowerShell. Here is my PowerShell script to rename a group in 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" #Function to Rename a Group Function Rename-SPOGroup([String]$SiteURL, [String]$OldGroupName,[String]$NewGroupName
How to Change a Group Name in SharePoint Online? How to Change a Group Name in SharePoint Online? Reviewed by Salaudeen Rajack on February 03, 2018 Rating: 5

How to Set Multiple Lines of Text Field Type to Rich Text or Enhanced Rich Text in SharePoint?

February 03, 2018    , , ,
How to Set Multiple Lines of Text Field Type to Rich Text or Enhanced Rich Text in SharePoint? Converting from plain text to rich text or enhanced rich text in SharePoint is simple, Go to the list settings >> Click on the column name to get in to the column settings. Select the column type to "Rich Text (Bold, italics, text alignment, hyperlinks)" or "Enhanced  rich text (Rich text with pictures, tables, and hyperlinks)" as per your requirement. Click on "OK" to save your changes. PowerShell to Set Multiple Lines of Text Field Type to Rich Text: Here is the PowerShell to change multi-line text field type from Plain text to Rich text or Enhanced rich text. Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Set Parameters $SiteURL = "https://intranet.crescent.com/sites/projects" $ListName = "Projects" $FieldInternalName="ProjectDescription" #Get the web, List and Field objects $web
How to Set Multiple Lines of Text Field Type to Rich Text or Enhanced Rich Text in SharePoint? How to Set Multiple Lines of Text Field Type to Rich Text or Enhanced Rich Text in SharePoint? Reviewed by Salaudeen Rajack on February 03, 2018 Rating: 5

SharePoint Online: Change Multiple Lines of Text Field Type to Rich Text using PowerShell

February 03, 2018    ,
Requirement: Change Multiple Lines of Text Field type to Rich Text in SharePoint Online. How to Change Multiple Lines of Text Field Type from Plain Text to Rich Text? Switching from plain text to rich text or enhanced rich text in SharePoint Online is quite simple, Go to the list or site where the target column exists. Get in to the column settings. Select the column type to "Rich Text (Bold, italics, text alignment, hyperlinks)" or "Enhanced  rich text (Rich text with pictures, tables, and hyperlinks)" as per your requirement. Click on "OK" to save your changes. PowerShell to Set Multiple Lines of Text Column type to "Rich Text" in 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.SharePoin
SharePoint Online: Change Multiple Lines of Text Field Type to Rich Text using PowerShell SharePoint Online: Change Multiple Lines of Text Field Type to Rich Text using PowerShell Reviewed by Salaudeen Rajack on February 03, 2018 Rating: 5

PowerShell to Search SharePoint and Export Results to CSV using Keyword Query

February 03, 2018    , , , ,
Requirement: Search SharePoint site and export the search results to CSV file using PowerShell. PowerShell to Export SharePoint Search Results to CSV: Here is the PowerShell to search all documents in a SharePoint Online site collection and export search results to CSV.   Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Set Parameters $SiteURL = "http://intranet.crescent.com/" $CSVFile = "C:\Temp\SearchResults.csv" #Get the site collection $Site = Get-SPSite $SiteURL #Frame Query to search: Get all documents sorted by Last modified $keywordQuery = New-Object Microsoft.Office.Server.Search.Query.KeywordQuery($Site) $SearchQuery = "site:http://intranet.crescent.com ContentType:document NOT FileExtension:aspx" $keywordQuery.QueryText = $SearchQuery $keywordQuery.SortList.Add("LastModifiedTime","Asc") #Execute Search $SearchExecutor = New-Object Microsoft.Office.Server.Search.Query.SearchExecutor $search
PowerShell to Search SharePoint and Export Results to CSV using Keyword Query PowerShell to Search SharePoint and Export Results to CSV using Keyword Query Reviewed by Salaudeen Rajack on February 03, 2018 Rating: 5

SharePoint Online: Change Content Type of List Items using PowerShell

February 02, 2018    , , , ,
Requirement: Change Content Type of All Items in a SharePoint Online List. How to Change Content Type in SharePoint Online? You can change content type of existing list items by editing the particular item and switching "Content Type" field. Well, Lets bulk change content type in SharePoint Online with PowerShell. Before changing the content type of list items, You must add the content type to the list first: How to Add a Content Type to List in SharePoint Online using PowerShell? Change Content type in SharePoint Online using PowerShell: Lets change the content type "Crescent Project V1" with "Crescent Project V2" for all list items (whichever item using the content type "Crescent Project V1").  #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
SharePoint Online: Change Content Type of List Items using PowerShell SharePoint Online: Change Content Type of List Items using PowerShell Reviewed by Salaudeen Rajack on February 02, 2018 Rating: 5

SharePoint Online: Delete Group using PowerShell

February 01, 2018    , , , ,
Requirement: SharePoint Online Delete Group using PowerShell How to Delete a SharePoint Online Group? Here is how to remove a user group in SharePoint Online Login to your SharePoint Online site >> Click on Settings gear >> Click Site Settings. On the Site Settings page, Click on "People and groups" under Users and Permissions section. Click on the Group Name from the left navigation. You may need to click on "More" and then select the group On the group page, click on Settings >> Group Settings On the group settings page, scroll down and click on the "Delete" button and confirm the prompt, click OK to remove the group in SharePoint Online. This deletes the user group in SharePoint Online. Now, lets delete SharePoint Online group using PowerShell! Removing a group from a site also removes the users within that group from the site. Delete SharePoint Online Group using Remove-SPOSiteGroup PowerShell cmdlet The Remove-SP
SharePoint Online: Delete Group using PowerShell SharePoint Online: Delete Group using PowerShell Reviewed by Salaudeen Rajack on February 01, 2018 Rating: 5
Powered by Blogger.