SPO Powershell commands

 


$requests = Get-SPOTenantServicePrincipalPermissionRequests $requestToApprove = $requests | ? { $_.Resource -eq 'Office 365 SharePoint Online' -and $_.Scope -eq 'MyFiles.Read' } | Select-Object -First 1 if ($requestToApprove -ne $null) { Approve-SPOTenantServicePrincipalPermissionRequest -RequestId $requestToApprove.Id }

Approve-SPOTenantServicePrincipalPermissionGrant -Resource "Microsoft Graph" -Scope "Mail.Read"


  1. Connect-SPOService -Url https://contoso-admin.sharepoint.com -Credential admin@contoso.com
1. Get Sharepoint Site ID in browser

    https://0wjd6.sharepoint.com/_api/site/id

2. Find the ListId

You can find the ListId by navigating to the SharePoint list, and then copying the URL, and finding the ID.

To find the ListId

  1. Open SharePoint, and navigate to the list that contains your workflow.
  2. Click Edit this list, and then click List in the ribbon.
  3. Click List Settings.
  4. Copy the URL, and find the text after List=.
  5. Remove "%7B" from the front of the list.
  6. Remove "%7D" from the end of the list.
  7. Change %2 to a hyphen. This will change the following string:
    %7B9D5F2138%2DC9E6%2D4473%2DA094%2DD7F4284C0388%7D
    to
    9D5F2138-C9E6-4473-A094-D7F4284C0388.

3. Get Sharepoint List Columns internal name


Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
 
#Configuration Parameters
$SiteURL="https://ohsdev.za.deloitte.com/"
$ListName= "Check%20Sheet%20New"
 
#Get the List
$List = (Get-SPWeb $SiteURL).Lists.TryGetList($ListName)
 
Write-Host "Field Name | Internal Name | Type"
Write-Host "------------------------------------"
 
#Loop through each field in the list and get the Field Title, Internal Name and Type
ForEach ($Field in $List.Fields)
{
    Write-Host $Field.Title"|"$Field.internalName"|"$Field.Type
}



Comments

Popular posts from this blog

Sites.Selected | Graph API SharePoint Permission

Configure the SharePoint Online App Catalog

Azure Function | Sharepoint List item | Call from Power Automate Flow