GirishKumarMs
I AM GIRISH KUMAR AND ON MY BLOG YOU CAN FIND MICROSOFT AND SHAREPOINT ARTICLES .I hope these articles may helps you. Just Check out.
Wednesday, September 23, 2020
Azure Function Chaining - Get web Title in SharePoint Online
Console Application to Create new Subsite under site collection using CSOM + SharePoint Online
using System;
using System.Security;
using Microsoft.SharePoint.Client;
namespace ConsoleAppCreateSubsite
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter Your Username Please ------- ");
string userName = Console.ReadLine();
//string userName = "girish.kumar@happiestbarik.onmicrosoft.com";
Console.WriteLine("Enter Your Password Please ------- ");
SecureString password = GetPasswordOfYourSite();
Console.WriteLine("Enter Your Site collection URL ------- ");
string SiteCollURL = Console.ReadLine();
Console.WriteLine("Enter Your New Subsite URL name ------- ");
string newSubsiteName = Console.ReadLine();
ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
using (var clientContext = new
ClientContext(SiteCollURL))
{
// SharePoint Online Credentials
clientContext.Credentials = new SharePointOnlineCredentials(userName, password);
// Get the SharePoint web
WebCreationInformation creation = new WebCreationInformation();
creation.Url = newSubsiteName; //"MyConsoleWeb";
creation.Title = "WelcomeToConsoleWeb";
Web newWeb = clientContext.Web.Webs.Add(creation);
// Retrieve the new web information.
clientContext.Load(newWeb, w => w.Title);
clientContext.ExecuteQuery();
clientContext.ExecuteQuery();
}
}
private static SecureString GetPasswordOfYourSite()
{
ConsoleKeyInfo info;
//Get the user's password as a SecureString
SecureString securePassword = new SecureString();
do
{
info = Console.ReadKey(true);
if (info.Key != ConsoleKey.Enter)
{
securePassword.AppendChar(info.KeyChar);
}
}
while (info.Key != ConsoleKey.Enter);
return securePassword;
}
}
}
Thursday, February 13, 2020
Powershell Script for add “everyone, except external users” to the visitors group
PS C:\WINDOWS\system32> $orgName="{Tenant name}"
PS C:\WINDOWS\system32> $userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."
PS C:\WINDOWS\system32> Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
Get-SPOUser -Site https://$orgName.sharepoint.com/sites/SiteName | Select DisplayName, LoginName
PS C:\WINDOWS\system32> Add-SPOUser -Site https://$orgName.sharepoint.com/sites/Coronavirus -LoginName "c:0-.f|rolemanager|spo-grid-all-users/{GUID}" -Group "Site Visitors"
Display Name Login Name Groups User Type
------------ ---------- ------ ---------
Everyone except external users spo-grid-all-users/{GUID} {Site Visitors} Member
All the Best! Thanks for reading my blog, please do comment and share if you feel helpful.
Tuesday, September 17, 2019
List of HTTP status codes
List of HTTP status codes
- 1xx (Informational): The request was received, continuing process
- 2xx (Successful): The request was successfully received, understood and accepted
- 3xx (Redirection): Further action needs to be taken in order to complete the request
- 4xx (Client Error): The request contains bad syntax or cannot be fulfilled
- 5xx (Server Error): The server failed to fulfill an apparently valid request
- Informational responses (
100
–199
), - Successful responses (
200
–299
), - Redirects (
300
–399
), - Client errors (
400
–499
), - and Server errors (
500
–599
).
Reference Links:
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
https://www.restapitutorial.com/httpstatuscodes.html
Friday, September 6, 2019
SPO Site Script & Site design + SharePoint Online
Each action is specified by the "verb" value in the JSON script. Also, actions can have subactions that are also "verb" values.
The overall JSON structure is specified as follows:
{ "$schema": "schema.json", "actions": [ ... <one or more verb actions> ... ], "bindata": { }, "version": 1 };
Get started creating site designs and site scripts
Scoping access to site designs
Site design JSON schema
SharePoint site design: PowerShell cmdlets
Site design and site script REST API
},
addContentType &
removeContentType
{
"verb": "addContentType",
"name": "Project Document"
},
{
"verb": "removeContentType",
"name": "Document"
}
/* Create Page - Content.aspx*/ { "verb": "createPage", "fileName": "Content.aspx", "pageData": { "Title": "Content", "BannerImageUrl": "", "CanvasContent1": "<div>/div>", "LayoutWebpartsContent": "" }, "setAsHomePage": false },
https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-json-schema
/*Set a site logo*/
{ "verb": "setSiteLogo", "url": "/Customer Event Collateral/logo.jpg" }
/*Install an add-in or solution */
/**Register an extension**/
/**Activate a Feature**/
/**Trigger a flow**/
{"verb": "triggerFlow", "url": "<A trigger URL of the Flow.>", "name": "Record and tweet site creation event", "parameters": { "event": "Microsoft Event", "product": "SharePoint" } }
/**POWERSHELL COMMANDS**/
$adminSiteUrl = "https://TENANT-admin.sharepoint.com"
$siteScriptFile = "C:\GK\DemoSiteScript.json"
$webTemplate = "68"
$OrgName="TENANT"
$siteScriptTitle = "Custom Com Site Script"
$siteDesignTitle = "Custom Com Site Design"
$siteDesignDescription = "Custom Com site design"
$previewImageUrl = ""
$designPackageId = "00000000-0000-0000-0000-000000000000"
$cred = Get-Credential
Connect-SPOService $adminSiteUrl -Credential $cred
Add-SPOSiteScript
$siteScript = (Get-Content $siteScriptFile -Raw | Add-SPOSiteScript -Title $siteScriptTitle) | Select -First 1 Id
Add-SPOSiteDesign
Add-SPOSiteDesign -SiteScripts $siteScript.Id -Title $siteDesignTitle -WebTemplate $webTemplate -Description $siteDesignDescription -PreviewImageUrl $previewImageUrl -DesignPackageId $designPackageId
Id : 4bdf454c-1395-4d6d-9d9d-01c546786a74
Title : Custom Com Site Design
WebTemplate : 68
SiteScriptIds : {6bb738e1-4abc-4a93-8c97-fae8e6815e30}
Description : Custom Com site design with create page
PreviewImageUrl :
PreviewImageAltText :
IsDefault : False
Version : 1
DesignPackageId : 00000000-0000-0000-0000-000000000000
MODIFYING AN EXISTING SITE SCRIPT
$siteScriptFile = "E:\SiteScripts\KRDemoSiteScript.json"
Get-SPOSiteScript
$siteScriptId ="bbbdc8a9-270d-4c89-80a7-1725ba07dea3"
Set-SPOSiteScript -Identity $siteScriptId -Content (Get-Content $siteScriptFile -Raw)
DELETING YOUR SITE DESIGNS AND SITE SCRIPTS
$siteScriptId=""
#$siteScriptId=""
Remove-SPOSiteDesign -Identity $siteDesignId
Remove-SPOSiteScript -Identity $siteScriptId
Remove-SPOSiteDesign -Identity "2ed26bec-ea03-4d4d-8343-ea8e7a8d78b0"
Remove-SPOSiteScript -Identity "4c9d6ff8-1088-40ff-8350-1eea62158900"
#Get the content of the JSON file and add it to the site script.
$siteScriptListContent = Get-Content 'SiteScripts\site-script-lists.json' -Raw
$siteScriptList = Add-SPOSiteScript -Title "CnC Lists" -Description "Adds a custom document library to the site" -Content $siteScriptListContent
#Get the content of the JSON file and add it to the site script.
$siteScriptTriggerFlowContent = Get-Content 'SiteScripts\site-script-triggerFlow.json' -Raw
$siteScriptTriggerFlow = Add-SPOSiteScript -Title "CnC Trigger Flow" -Description "Triggers a Microsoft Flow" -Content $siteScriptTriggerFlowContent
#Create a basic site design only using the lists site script.
Add-SPOSiteDesign -Title "CnC Basic Communication site" -WebTemplate "68" -SiteScripts $siteScriptList.ID -Description "CnC basic communication site"
#Create an advanced site design by using the lists as well as flow site scripts
Add-SPOSiteDesign -Title "CnC Advanced Communication site" -WebTemplate "68" -SiteScripts $siteScriptList.ID, $siteScriptTriggerFlow.ID -Description "CnC advanced communication site"
Connect-PnPOnline $adminSiteUrl -Credential $cred
OR
Connect-PnPOnline -Url "https://TENANT-admin.sharepoint.com"
Connect-PnPOnline -Url $adminSiteUrl
Get-PnPApp
Id Title Deployed AppCatalogVersion Installed
Version
-- ----- -------- ----------------- ---------
3b47da46-8ff4-46bc-bb19-e2c90d3e3832 helloworld-webpart-react-client-side-solution True 1.0.0.0
5e8c223e-440c-4cb7-ab00-a6ca6d3fd5b3 Improved Content editor True 1.0.0.0
42dbd79a-96d9-4012-b898-738e0f356004 SPFx Fantastic 40 WebParts True 1.0.4.0
b7e2b572-1bc7-4053-9545-d8fd0129abc3 Modern Script Editor web part by Puzzlepart True 1.0.0.10
fd26d165-7216-442b-a138-4b8e7825d083 singlepageapppart-client-side-solution True 1.0.0.0
1ceea556-f363-4cab-8597-2f7494d0c8c2 footer-app-customizer-client-side-solution True 1.0.0.0
f9608df3-2244-40fb-8ef9-7dc28f4e994e header-style-client-side-solution True 1.3.0.0
3e9f5c2d-67c6-48f3-a8fe-5ca6466f410b default-sp-webpart-client-side-solution True 1.0.0.0
/****/
https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-json-schema
https://laurakokkarinen.com/the-ultimate-guide-to-sharepoint-site-designs-and-site-scripts/
https://www.vrdmn.com/2018/01/combine-and-re-use-multiple-site.html
PROVISIONING TEAMS WITH A SITE DESIGN, FLOW AND MICROSOFT GRAPH
DOES IT SPARK JOY? POWERSHELL SCRIPTS FOR KEEPING YOUR DEVELOPMENT ENVIRONMENT TIDY AND SPOTLESS
MY MOST USED POWERSHELL SCRIPTS FOR MANAGING SHAREPOINT ONLINE
AUTHENTICATING TO OFFICE 365 APIS WITH A CERTIFICATE — STEP-BY-STEP
https://laurakokkarinen.com/authenticating-to-office-365-apis-with-a-certificate-step-by-step/HOW TO BUILD A GUEST USER SELF-SERVICE REGISTRATION FOR OFFICE 365 WITH AZURE
https://laurakokkarinen.com/how-to-build-a-guest-user-self-service-registration-for-office-365-with-azure/HOW TO COMPLETELY DISABLE EXTERNAL SHARING FOR A SINGLE OFFICE 365 GROUP
https://laurakokkarinen.com/how-to-completely-disable-external-sharing-for-a-single-office-365-group/
Azure Function Chaining - Get web Title in SharePoint Online
Visual Studio sample code Here is the orchestration as a single C# file in a Visual Studio project: using System.Collections.Generi...

-
While getting this error "Cannot implicitly convert type 'Newtonsoft.Json.Linq.JArray' to 'string[]'" MenuJson...
-
Error Message : - {"Autodiscover blocked a potentially insecure redirection to https://autodiscover-s.outlook.com/autodiscover/...
-
How to get Author/Title or Name from AuthorID = dataResults.Title function getUser(id, tdHtml){ var returnValue; jQuery.ajax(...
