CAML Query to Filter Yes/No (Check box) Field Values using PowerShell

April 30, 2017    , , ,
Requirement: CAML Query to Filter Yes/No Field Values in PowerShell CAML Query to Filter Yes/No Field Values in SharePoint Online: Lets use PowerShell to query Yes/No field type values from a SharePoint Online list.   #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://crescent.sharepoint.com/" $ListName="Projects" $FieldName="IsActive" #Internal Name $FieldValue="1" #0 for FALSE #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) #Ge
CAML Query to Filter Yes/No (Check box) Field Values using PowerShell CAML Query to Filter Yes/No (Check box) Field Values using PowerShell Reviewed by Salaudeen Rajack on April 30, 2017 Rating: 5

SharePoint Online: Get Site Collection Storage Size - Quota Usage Report using PowerShell

April 30, 2017    , , , , ,
Requirement: Need to generate a report to analyze all SharePoint Online Site collection storage consumption.  How to Get the Storage Metrics of a SharePoint Online Site Collection? To find the storage details of a site collection, Go to: Click on Settings gear and then select Site Settings. In the "Site Settings" page, under "Site Collection Administration", click on Storage Metrics. This page gives SharePoint Online site collection storage details along with the breakdown of data usage. SharePoint Online: Get Site Collection Size using PowerShell Let's use PowerShell script to get the storage size allocated, used and warning level metrics. This script gets storage info for a single site collection using PowerShell: #Config Parameters $AdminSiteURL="https://crescent-admin.sharepoint.com" $SiteURL="https://crescent.sharepoint.com/sites/Ops" #Get Credentials to connect to SharePoint Admin Center $Cred = Get-Credential #Connect
SharePoint Online: Get Site Collection Storage Size - Quota Usage Report using PowerShell SharePoint Online: Get Site Collection Storage Size - Quota Usage Report using PowerShell Reviewed by Salaudeen Rajack on April 30, 2017 Rating: 5

SharePoint Online: Get-Set "Yes/No (Check box)" Field Value using PowerShell

April 30, 2017    , ,
Requirement: Get or Set Yes/No Field Value in SharePoint Online using PowerShell. PowerShell to Get Value of Yes/No Field in SharePoint Online: Here is how you can read Yes/No field programmatically 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" #Set parameter values accordingly $SiteURL="https://crescent.sharepoint.com/" $ListName="Projects" $FieldName="IsActive" #Internal Name $ListItemID="5" #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
SharePoint Online: Get-Set "Yes/No (Check box)" Field Value using PowerShell SharePoint Online: Get-Set "Yes/No (Check box)" Field Value using PowerShell Reviewed by Salaudeen Rajack on April 30, 2017 Rating: 5

How to Delete OneDrive for Business Site Collection in SharePoint Online?

April 30, 2017    , , , ,
Requirement: Delete OneDrive for Business Site Collection! After a business decision made to disable OneDrive in organization wide, We configured the settings to disable OneDrive. However,  All existing OneDrive sites were active, users can access them and we wanted to remove them all! Any SharePoint My Site or OneDrive for business site gets deleted in 30 days (retention period) from user account deleted from AD or when license is deactivated for the user in Office 365. How to Delete OneDrive for Business Site Collection in SharePoint Online? You can delete OneDrive sites by navigating to: https://DomainName-my.sharepoint.com/personal/UserName_TenanntName_com/_layouts/15/Deleteweb.aspx and then "Delete" button. Deleting OneDrive for Business site collection is as same as deleting any SharePoint sites, But there is no way to delete it using browser UI. So, you can utilize Remove-SPOSite cmdlet to delete any OneDrive for Business (My Site) site collection. PowerS
How to Delete OneDrive for Business Site Collection in SharePoint Online? How to Delete OneDrive for Business Site Collection in SharePoint Online? Reviewed by Salaudeen Rajack on April 30, 2017 Rating: 5

How to Set Secondary Admin for All OneDrive for Business Sites?

April 30, 2017    , , , ,
When SharePoint My Site or OneDrive for business site collection are created by the user, SharePoint assigns primary site collection administrator rights to the user. At times, you may have to gain Admin access in situations such as User left the organization, troubleshooting, etc. In SharePoint on-premises environments, we've "User Policy" option for web applications which provides Admin rights to the whole web application. In SharePoint Online we don't have user policies but fortunately, we have the option to set secondary admin for all My sites to avoid adding them in every single site collection. While its possible to add additional site collection administrators to SharePoint Online My Sites, Here is how you can specify the default secondary site owner for all OneDrive for Business sites in SharePoint Online. Login to your SharePoint Online Admin Center  Click on User Profiles from left navigation Click on My Site Settings >> Setup My Sites >&
How to Set Secondary Admin for All OneDrive for Business Sites? How to Set Secondary Admin for All OneDrive for Business Sites? Reviewed by Salaudeen Rajack on April 30, 2017 Rating: 5

There was a problem deleting Web site "Site-URL". Sites that have subsites or certain apps can't be deleted. Please try again after deleting all subsites and removing the apps.

April 29, 2017    , , ,
Problem: If you try to delete a SharePoint Online site which has subsites in it, SharePoint throws error message saying " There was a problem deleting Web site "<subsite-url>". Sites that have subsites or certain apps can't be deleted. Please try again after deleting all subsites and removing the apps. " Solution: So, basically SharePoint Online tells us: You have to delete all subsites first, in order to delete its parent site. Deleting a subsite is a matter of few clicks: Go to Site Settings >> Click on "Delete this site" link under site actions group. Confirm the prompt once. However, the problem is: When you have larger number of subsites (say: 50!) its cumbersome and time consuming process to delete each and every subsite using browser interface. So, the solution is PowerShell! PowerShell to delete a subsite in SharePoint Online: #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Mic
There was a problem deleting Web site "Site-URL". Sites that have subsites or certain apps can't be deleted. Please try again after deleting all subsites and removing the apps. There was a problem deleting Web site "Site-URL". Sites that have subsites or certain apps can't be deleted. Please try again after deleting all subsites and removing the apps. Reviewed by Salaudeen Rajack on April 29, 2017 Rating: 5

How to Gain Owner Access to OneDrive for Business Sites in Office 365?

April 29, 2017    , , , ,
By default, When SharePoint My Site or OneDrive site collection is created by the user, SharePoint assigns primary site collection administrator rights to the user. In some cases you might need to gain Admin access to a OneDrive for Business site of a user. E.g. User left the company and manager of the user wants to gain access, Backup purposes, compliance, security, etc. How to get admin access to the OneDrive for Business site in Office 365? To gain access to a user's OneDrive site, follow these steps: Login to SharePoint Online Admin Center Click on "User Profiles" link from left navigation >> Click on "Manage User Profiles" link under "People" group Search and pick the user profile which you want to gain access. From the search result, Click on the menu item "Manage site collection owners" from the context menu. Add any additional administrators to the site collection in "Site Collection Administrators" field.
How to Gain Owner Access to OneDrive for Business Sites in Office 365? How to Gain Owner Access to OneDrive for Business Sites in Office 365? Reviewed by Salaudeen Rajack on April 29, 2017 Rating: 5

SharePoint Online: Check if Feature is Activated using PowerShell

April 29, 2017    , , , ,
Requirement: PowerShell to check if feature is activated in SharePoint Online. How to Check if a specific Feature is Enabled in SharePoint? To check the current status of a SharePoint feature, Say: Publishing Feature - follow these steps: Navigate to Site Settings >> Click on "Site Collection Features" link under "Site collection administration (If its a site level feature, use: "Manage Site Features" link under "Site Actions" group!) Check the button next to your feature. If the button shows just "Activate" then the feature is not activated. If the button shows "Deactivate" and the "Active"highlighted then the feature is already activated. SharePoint Online: PowerShell to Check if Feature is Activated Prior to enabling or disabling a feature in SharePoint Online, we can check the current status of the feature in PowerShell with this script. Lets take an example of "Publishing Feature" and chec
SharePoint Online: Check if Feature is Activated using PowerShell SharePoint Online: Check if Feature is Activated using PowerShell Reviewed by Salaudeen Rajack on April 29, 2017 Rating: 5

SharePoint Online: Find Content Type usage using PowerShell

April 28, 2017    , ,
Requirement: Find where a Content Type is used in SharePoint Online You may have to find the content type usage in scenarios like, You are getting "content type is still in use" error when trying to delete a content type. You are trying to figure out where a particular content type is being used, etc. PowerShell to Find Content Type Usage in SharePoint Online Unlike SharePoint On-premises, We don't have SPContentTypeUsage class available in CSOM. So we are left with an option: Scan each and every list to get the content type usage! #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 get the content type usage Function Find-SPOContentTypeUsage([String]$SiteURL) { Try{ Write-host
SharePoint Online: Find Content Type usage using PowerShell SharePoint Online: Find Content Type usage using PowerShell Reviewed by Salaudeen Rajack on April 28, 2017 Rating: 5

SharePoint Online: Set Content Type to Read Only using PowerShell

April 27, 2017    , , , ,
Requirement: Make a Content type to read only in SharePoint Online. How to Make a Content Type to Read-Only in SharePoint Online? To set a content type to read only: Go to Settings >> Site settings Click on "Site content types" link From the content types listed, Click on the name of the content type Go to Advanced settings in content type settings page.  Set "Yes" for Should this content type be read only?" SharePoint Online: PowerShell to Set Content Type to Read Only #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" #Config Parameters $SiteURL="https://crescent.sharepoint.com" $ContentTypeName="Business Contacts" Try { #Get Credentials to connect
SharePoint Online: Set Content Type to Read Only using PowerShell SharePoint Online: Set Content Type to Read Only using PowerShell Reviewed by Salaudeen Rajack on April 27, 2017 Rating: 5

SharePoint Online: Update List Title, Description, Quick Launch Navigation Properties using PowerShell

April 26, 2017    , , ,
Requirement: Set Title, Description and Quick Launch Navigation settings in a SharePoint Online List. How to Update List Title, Description and Quick Launch Navigation Settings in SharePoint Online? To set list title, description and quick launch navigation options in SharePoint Online, follow these steps: Navigate to your target list or library. Click on Settings Icon and then "Library Settings" (In Classic SharePoint, Under "List" tab, Click on "List Settings" button in the ribbon) In the List or Library settings page, Click on "List name, description and navigation" link under General Settings. General Settings page, You can update the Title of the list, Description for the list and the option to show or hide list in Quick launch navigation. Click on "Save" to commit your changes. PowerShell to Set List Title, Description and Quick Launch Navigation Settings: Here is the PowerShell script to update list settings. #
SharePoint Online: Update List Title, Description, Quick Launch Navigation Properties using PowerShell SharePoint Online: Update List Title, Description, Quick Launch Navigation Properties using PowerShell Reviewed by Salaudeen Rajack on April 26, 2017 Rating: 5

SharePoint Online: PowerShell to Iterate Through All Files in a Document Library

April 24, 2017    , , ,
Requirement: Get List of Files in a SharePoint Online Document Library using PowerShell SharePoint Online PowerShell to Iterate through All Files in a Document Library: Often in PowerShell scripting, we may have to loop through each file in a SharePoint Online libraries. This PowerShell script iterates through each folder of the library and lists all files. #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 get all files of a folder Function Get-FilesFromFolder([Microsoft.SharePoint.Client.Folder]$Folder) { Write-host -f Yellow "Processing Folder:"$Folder.ServerRelativeUrl #Get All Files of the Folder $Ctx.load($Folder.files) $Ctx.ExecuteQuery() #list all files in Folder
SharePoint Online: PowerShell to Iterate Through All Files in a Document Library SharePoint Online: PowerShell to Iterate Through All Files in a Document Library Reviewed by Salaudeen Rajack on April 24, 2017 Rating: 5

How to Enable External Sharing in SharePoint Online?

April 24, 2017    , , , ,
Requirement: Enable external sharing in SharePoint Online using PowerShell SharePoint Online allows you to collaboratively share your content with external users such as vendors, clients, customers, etc. To enable external sharing, you should turn on external sharing both on tenant level as well as on site collection level. External Sharing settings in SharePoint Online offers below options: Don't allow sharing outside your organization - disable external sharing! Allow sharing only with the external users that already exist in your organization's directory. Allow external users who accept sharing invitations and sign in as authenticated users. Allow sharing with all external users, and by using anonymous access links. How to Enable External Sharing in SharePoint Online? To turn on external sharing in SharePoint online, follow these steps: Open SharePoint Online Admin Center (Typically: https://TENANT-admin.sharepoint.com) Click on "Sharing" from left
How to Enable External Sharing in SharePoint Online? How to Enable External Sharing in SharePoint Online? Reviewed by Salaudeen Rajack on April 24, 2017 Rating: 5

How to Set Choice Field Default Value to Blank in SharePoint?

April 23, 2017    
By default, when you create a new choice field, the very first choice you entered is also set as "Default value" in field settings. This results filling up the default value for the field in new item creation page (NewForm.aspx). However, there are times you may want to have a empty value choice field (in other worlds, set choice field default to blank). How to set choice field default blank value in SharePoint? To set choice field to empty value, simply clear the default value of the choice field in choice field settings. This makes the choice field default to blank value! Also allows blank value in Choice field. Set Choice Field to Empty Value using PowerShell: If you want to make blank value as default for choice column, you can use this PowerShell way too!   Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue $WebURL="http://intranet.crescent.com/" $ListName ="Projects" $ChoiceFieldName="Category" $Fiel
How to Set Choice Field Default Value to Blank in SharePoint? How to Set Choice Field Default Value to Blank in SharePoint? Reviewed by Salaudeen Rajack on April 23, 2017 Rating: 5

Get-Set Choice Field Value in SharePoint using PowerShell

April 23, 2017    , , ,
Here is my nifty collection of PowerShell scripts to read or update values in Choice column in SharePoint.  SharePoint: PowerShell to Get Choice Field Value PowerShell to get choice field values #Define URL and List name variables $WebURL="http://intranet.crescent.com/" $ListName ="Projects" $Web = Get-SPWeb $WebURL $List = $Web.lists.TryGetList($ListName) #Get the 1st item stored in the list $Item = $list.items[0] #Get the formatted value of "Department" choice column Write-host "Choice Field Value:" $item.GetFormattedValue("Department") PowerShell to Get Multiple Choices Field Value We can get choice field value programmatically using this PowerShell script. Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue $WebURL="http://intranet.crescent.com/" $ListName ="Projects" $MultiChoiceFieldName="Category" $Web = Get-SPWeb $WebURL $List = $Web.lists.TryGetList($Lis
Get-Set Choice Field Value in SharePoint using PowerShell Get-Set Choice Field Value in SharePoint using PowerShell Reviewed by Salaudeen Rajack on April 23, 2017 Rating: 5

Enable Blank Site Template in SharePoint 2016

April 22, 2017    , , , ,
Problem: Blank site template is not available in SharePoint 2013 and SharePoint 2016. If you try to create a site collection from SharePoint Central Administration site or try to create a subsite, you'll find blank site template missing from the create site collection page. Unlike its previous versions, SharePoint 2013 on wards certain site templates are hidden from the user interface.  So, How to create a blank site collection in SharePoint 2016? PowerShell to Create a site collection using blank site template We can create a site collection using blank site template with PowerShell. Blank site template id in SharePoint 2016 or SharePoint 2013 is: STS#1 Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Define Parameters $Template = Get-SPWebTemplate "STS#1" $SiteURL="http://intranet.crescent.com/sites/blank" $SiteOwner="Crescent\SPAdmin" #Create blank site collection New-SPSite -Url $SiteURL -OwnerAlias $SiteOw
Enable Blank Site Template in SharePoint 2016 Enable Blank Site Template in SharePoint 2016 Reviewed by Salaudeen Rajack on April 22, 2017 Rating: 5

Remove SharePoint Web Application Policy using PowerShell

April 20, 2017    , , , , , ,
Requirement: Remove Web Application Policy using PowerShell How to remove a web application Policy in SharePoint? To remove a user or group from SharePoint web application Policy, follow these steps: Login to SharePoint Central Administration Site Application Management >> Manage Web Applications  Select the appropriate web application from the list >> Click on "User Policy" button from the ribbon.  Now, from the "Policy for Web Application" page, Select the user or group to remove and click on "Delete Selected Users" link Confirm the prompt once to remove select accounts from web application Policy. PowerShell to Remove a Web Application Policy in SharePoint: Here is the PowerShell script to delete a web application policy in SharePoint. Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue Function Remove-WebAppPolicy($WebAppURL, $Account) { Try { Write-host "Removing Account '$Acc
Remove SharePoint Web Application Policy using PowerShell Remove SharePoint Web Application Policy using PowerShell Reviewed by Salaudeen Rajack on April 20, 2017 Rating: 5

How to Delete a Host Named Site Collection in SharePoint using PowerShell?

April 20, 2017    , , ,
Requirement: Delete host named site collection using PowerShell in SharePoint. How to Delete host named Site Collection? Generally, Host named site collections in SharePoint are managed through PowerShell. Prior to SharePoint 2013, You cannot delete host named site collections from Central Administration site as the delete button is greyed out on delete site collection page. However, from SharePoint 2013 you can delete either host named site collection or path based site collection from: Central Administration >> Application Management >> Delete Site Collection Select the site collection from the drop down and hit "Delete" button Confirm the prompt once to delete the host named site collection. Delete host named site collection using PowerShell: To delete a Host named site collection using PowerShell, use Remove-SPSite cmdlet in SharePoint Management Shell. Remove-SPSite -Identity "http://Host-Named-Site-Collection-URL" This removes gi
How to Delete a Host Named Site Collection in SharePoint using PowerShell? How to Delete a Host Named Site Collection in SharePoint using PowerShell? Reviewed by Salaudeen Rajack on April 20, 2017 Rating: 5

SharePoint Online: PowerShell to Loop Through List Items

April 19, 2017    , , ,
Requirement: SharePoint Online PowerShell to Loop through List Items Make sure you have SharePoint Online Client SDK downloaded and installed in your machine before running the script: https://www.microsoft.com/en-us/download/details.aspx?id=42038 PowerShell to Loop through List Items in SharePoint Online Here is a basic example for iterating through each list item in a SharePoint Online list or library. #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" #Config Parameters $SiteURL="https://crescenttech.sharepoint.com" $ListName="Projects" #Setup Credentials to connect $Cred= Get-Credential $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred
SharePoint Online: PowerShell to Loop Through List Items SharePoint Online: PowerShell to Loop Through List Items Reviewed by Salaudeen Rajack on April 19, 2017 Rating: 5

"Audit Log Reports" Link Missing in SharePoint?

April 19, 2017    , , , ,
Problem: Audit log reports missing in SharePoint! We enabled auditing for a SharePoint Online site collection but when under site settings page, found "Audit Log Reports" link missing. How to enable audit log reports in SharePoint? To enable audit log reports in SharePoint On-premises or in SharePoint Online, we've to activate "Reporting" feature in Site collection features. To fix audit log reports missing issue follow these steps: Navigate to SharePoint site settings Page >> Click on Site collection features under Site Collection Administration Find "Reporting" feature. Click on activate button next to it to activate the feature. This makes audit log reports available in site settings page under "Site Collection Administration" section. Audit Log Reports URL: https://crescent.sharepoint.com/_layouts/15/Reporting.aspx?Category=Auditing
"Audit Log Reports" Link Missing in SharePoint? "Audit Log Reports" Link Missing in SharePoint? Reviewed by Salaudeen Rajack on April 19, 2017 Rating: 5

Style SharePoint 2016 List View Web Part with Custom CSS

April 16, 2017    , , , ,
Requirement: Add a custom style to SharePoint 2016's standard list view web part to make it look like a dashboard! By default, SharePoint list view web part looks dull, isn't it? So, lets add some custom CSS to the SharePoint 2016 list view, to make it look like a dashboard! How to add CSS to listview? Simple, Click on Site Settings gear >> Edit Page Insert web part >> Choose "Script Editor" under "Media and Content" Place the below CSS code in it. Save and close! CSS to Brand SharePoint List view: <style type="text/css"> /* List View Header */ .ms-listviewtable > thead > tr > th { background-color: #5B9BD5; } /* List view Header Text color*/ .ms-vh-div, .ms-headerSortTitleLink { color:white!important; font-weight: bold; } /* background color for alternate rows */ .ms-listviewtable > tbody > tr.ms-alternating { background: #DDEBF7 } </style> Here is the output of the branded List view web p
Style SharePoint 2016 List View Web Part with Custom CSS Style SharePoint 2016 List View Web Part with Custom CSS Reviewed by Salaudeen Rajack on April 16, 2017 Rating: 5

SharePoint Online: CAML Query for Choice Field in PowerShell

April 05, 2017    , , ,
Requirement: CAML Query for Choice Field in SharePoint Online using PowerShell. Get List Items Where a Choice Field is Equal to Particular Value: Lets get all projects from projects list where the "Priority" choice field is "Medium" #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://crescent.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 Object $List = $Ctx.Web.lists.GetByTitle
SharePoint Online: CAML Query for Choice Field in PowerShell SharePoint Online: CAML Query for Choice Field in PowerShell Reviewed by Salaudeen Rajack on April 05, 2017 Rating: 5

SharePoint Online: CAML Query for Lookup Field in PowerShell

April 05, 2017    , ,
Requirement: CAML Query for Lookup field in SharePoint Online using PowerShell CAML for SharePoint Lookup Field Value: Lets filter projects by parent project lookup field value "Address Book". Here is the SharePoint CAML for lookup field. #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://crescent.sharepoint.com/" $ListName="Projects" $LookupValue="Address Book" #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 Object
SharePoint Online: CAML Query for Lookup Field in PowerShell SharePoint Online: CAML Query for Lookup Field in PowerShell Reviewed by Salaudeen Rajack on April 05, 2017 Rating: 5

SharePoint Online: CAML Query for Person or Group Field in PowerShell

April 04, 2017    , , , ,
Requirement: SharePoint Online CAML Query for Person or Group field SharePoint Online: CAML Query to Filter Person or Group Field in PowerShell Lets say, we want to filter and get all projects where "Project Manager" user field value is a particular person. #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://crescent.sharepoint.com/" $ListName="Projects" $UserID="salaudeen@crescent.com" #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
SharePoint Online: CAML Query for Person or Group Field in PowerShell SharePoint Online: CAML Query for Person or Group Field in PowerShell Reviewed by Salaudeen Rajack on April 04, 2017 Rating: 5
Powered by Blogger.