1

I am working on my first sharepoint online project. now when we work with sharepoint on-premise we use SharePoint Management shell , to execute power-shell commands.

now on my sharepoint online 2013 , currently i need to run these 2 commands:-

1.To enable custom scripting

Set-SPOsite -DenyAddAndCustomizePages 0

and

2.To enable master page editting :-

# Paths to SDK. Please verify location on your computer. 
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"  
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"  

# Insert the credentials and the name of the admin site 
$Username="admin@tenant.onmicrosoft.com" 
$AdminPassword=Read-Host -Prompt "Password" -AsSecureString 
$Url="https://tenant.sharepoint.com/sites/teamsitewithlibraries" 
$setting=$true

so i am not sure why tool i need to use "SharePoint Online Client Components SDK " OR " SharePoint Online Management Shell" ?? any why. or each script need separate toolS ???

2

You need both. The management shell allows you to talk to SharePoint Online. The client components are necessary to bridge the gap in functionality between on prem powershell commands and cloud commandlet offerings. I just put together a post on setting up PowerShell for Office 365 usage.

The management shell has a limited subset of commands, so sometimes you can use a native command, but most often you need to you the client components to use CSOM in PowerShell. If you don't want to use PowerShell, you can build your own console apps using the CSOM framework.

http://ericjalexander.com/blog/2016/11/03/Setting-Up-PowerShell

Also, modifying the master page in SharePoint Online is highly discouraged. Altering it means you will be missing out on features as Microsoft rolls them out. There are other means to satisfy customization, like using the Alternate CSS properties to attach a custom CSS override or use themes to change the look, or using Custom Actions to do custom Javascript.

By customizing your master page, if Microsoft updates the command bar, or app launcher, or rolls out new UI components, you might not get them. You have to determine what has changed in their stock master page, then roll that into yours and then replicate that across your entire collection.

  • thanks for the reply.. first point what do you mean by "The client components are necessary to bridge the gap between on prem and cloud commandlet offerings"? second point can i know why it is discouraged to modify the master page? now let say i want to define a custom css or apply some changes to the layout,, then how i can do so? i mean when i work with on-premise sharepoint, i use to take a copy of the seatle.master master page, and do some modification to the new master page. and i have never face any problem.. – john Gu Nov 11 '16 at 17:49
  • although we have install many updates to sharepoint ,, or the situation with SP online is different ? at the end the original seatle.master will stay as is,, and incase we face any problem i can publish the original seatle.master as default master page again... does this sound valid ? – john Gu Nov 11 '16 at 17:55
  • 1
    You need the client components to be able to create your own functions using CSOM, a few examples, there is not a Get-SPList or Get-SPWeb in the SharePoint Management Shell, you have to create that yourself. The PowerShell coverage between the cloud and on prem is night and day. – Eric Alexander Nov 11 '16 at 18:05
  • ok i thought you mean that i need the client components to bridge the gap between an existing SP on-premise.. so now my PC is on windows-7 .. and to be able to install both of them i need powershell 3.0 (currently i have powershell 1.0),, so to get powershell 3.0 i need to install Windows Management Framework ?? is this correct ? second point , now inside my PC i have sharepoint designer 2013 installed,, so generally speaking can installing; Windows Management Framework & the SDK & the online managemnt shell affect the sharepoint designer ? – john Gu Nov 11 '16 at 18:13
  • 1
    correct, framework, management shell, client components. It shouldnt have an affect on spd – Eric Alexander Nov 11 '16 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.