Identify The Modern Pages And Copy Them To Another Site Collection

In this blog, I am going to perform two actions – Identify if a page is a modern page or not. Migrate or copy that modern page (including its content) to another site collection or site (destination location) I am going to accomplish these tasks by using CSOM (Client Object Model). After identifying the modern page, I will copy the […]

Wildcard search of Users using CSOM in SharePoint

In this blog, I will explain how to find users using ClientPeoplePickerSearchUser class. There are many ways in CSOM to get the users from SharePoint site or web but I did not find any proper way to perform wildcard search of users from SharePoint site using CSOM. For e.g lets, I want to find all users present in site collection […]

Add and Remove Site Columns from Site Content Type

In this blog post, I am going to add and remove site columns in existing site content type. Content types empower you to arrange, oversee, and handle content reliably across your sites. To view all content types used in the site collection. Open SharePoint site Navigate to site settings ->Under Web designer galleries -> Click Site content type or navigate […]

Change User Regional Setting to “Always follow Web” using PowerShell

I have written this PowerShell script which is related to user regional setting. This below-mentioned code block will help us to change user regional setting to “always follow web” regional setting. [code lang=”c”] Write-Host -ForegroundColor cyan ‘Please provide the site url’ $SiteURL = Read-Host “Site Url” try { Add-PSSnapin “Microsoft.SharePoint.PowerShell” $SPsiteURL = Get-SPSite $SiteURL $SPserviceContext = Get-SPServiceContext $SPsiteURL $SPweb = […]

Crud Operations on a List

This code block is related to create, delete, update and add list items to a custom list. [code lang=”c”] using System; using Microsoft.SharePoint.Client; using System.Security; namespace List_Crud_Operations { class Program { static void Main(string[] args) { ClientContext ctx = new ClientContext(“http://portal/sites/site1”); Web web = ctx.Web; var password = “Password”; SecureString secureString = new SecureString(); foreach (char c in password.ToCharArray()) secureString.AppendChar(c); […]

How to Inject your Custom JavaScript in Modern Pages on Page Load

This SPFx functionality helps to inject your custom JavaScript file in your modern site pages on page load. [code lang=”c”] export default class MySPFXApplicationCustomizer extends BaseApplicationCustomizer<IMySPFXApplicationCustomizerProperties> { private _customJsUrl: string = “https://sharepointdomain.net/scripts/MyCustonScript.js”; @override public onInit(): Promise<void> { let scriptTag: HTMLScriptElement = document.createElement(“script”); scriptTag.src = this._customJsUrl; scriptTag.type = “text/javascript”; document.getElementsByTagName(“head”)[0].appendChild(scriptTag); return Promise.resolve<void>(); } } [/code] This solution is brought to you […]

Get members from Office 365 Azure Ad using Graph API

1.Create a WPF application 2. Add the below mentioned code in the App.xaml.cs page. [code lang=”c”] private static string ClientId = “0b8b0665-bc13-4fdc-bd72-e0227b9fc011″; private static PublicClientApplication _clientApp ; public static PublicClientApplication PublicClientApp { get { return _clientApp; } } static App() { _clientApp = new PublicClientApplication(ClientId); }[/code] 3.In mainwindow.xaml Add a button for calling the graph and a multiline textbox to […]