GithubHelp home page GithubHelp logo

powershellscripts / sharepointonline-scriptsamples Goto Github PK

View Code? Open in Web Editor NEW
100.0 100.0 37.0 16.78 MB

Over 260 scripts for SharePoint Online (SPO), OneDrive for Business, and SharePoint Server. The samples fix issues, provide reports and extra settings not available via UI. The scripts use Powershell, C#, CSOM and REST. They include copies of existing scripts from Technet Gallery years 2013-2019. >>> Scroll down to see the full index

C# 3.00% PowerShell 97.00%
csharp office-365 office365 powershell powershell-script sharepoint-2016 sharepoint-online

sharepointonline-scriptsamples's People

Contributors

anaida-debug avatar dem123-cthulu avatar dotcom-better avatar jakubpiegza avatar kozacki-antoni avatar pfounders avatar powershellscripts avatar szymon209 avatar whoeverami avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

sharepointonline-scriptsamples's Issues

SharePoint Online Site Policy

@PowershellScripts
I have created site policy in content type hub and trying to apply site policy to site collection using powershell but its not applying. I am able to activate at site collection level but not able to apply it. I tried it with another approach i.e applied it manually and then remove it and after that I tried with powershell it worked...bt I want to applied it without manually activating and de activating.
Can anyone please suggest?
Also, Our tenancy has multiple site collections and webs, and all have a Site Policy applied. I've now been asked to remove the policy from all sites. Doing it manually is not an option.

Is there a CSOM or PnP command or snippet I can execute via PowerShell that will allow me to remove a Site Policy from a site?

Permission issue to browse lists of SPO sites

Greetings,
I'm noob to Github so please pardon me if this is not the appropriate place to discuss this.

I am very interested in your work, notably the "Versioning" scripts for SharePoint Online. I were redirected by Microsoft Support to your TechNet Library site, but as TechNet is being decommissioned, commenting seems to have been disabled, therefore here I am.

In all the documentation/explanations I've found about the scripts, you don't mention the necessary permissions to run them further than "SharePoint administrator".
I use a tenant global admin account, which has access to the SharerPoint admin center, and I get "401 unauthorized" on all the SPO sites I am trying to browse with the scripts.
I manage to connect to SPO, I can list all the sites URLs, name, MB usage etc..
But when I load the lists in the context (ctx.Load($Lists)), once I try to execute the query ($ctx.ExecuteQuery()) , I get an error "The remote server returned an error: (401) Unauthorized".

If I put myself (or the global admin) Owner of a site of course it works correctly, but it's not so clean because it'll be seen by site members, and I would like the operation to be as invisible as possible, just like we did with SP onprem when we were Farm Admins (I know, this doesn't exist anymore in SPO).

In the example screenshots you provide on TechNet for those scripts, I see a lot of sites you are able to list.

So my question is: Did you put yourself (or the account you run the script with) Owner of every site beforehand?

Or, what I'm really hoping here, there is a less known permission somewhere to give to an admin account, so that it can browse the content of all sites? If so, can you tell me which one?

Great Code! how to add subsites?

Thank you for the code.
I am trying to set versioning on for a a few sites and I am reading them from a text file.
All is well, but how to add so it will run on the sub-sites of those site collection as well.

foreach ($line in Get-Content c:\sites.txt) {
$sitecollection=Get-SPosite $line
set-Versioning -Url $sitecollection.url -Username $Username -Password $Password -Versioning $Versioning
}

thanks!
Effy.

Cannot write "property"

When trying to run BlockDownloadOfAllFilesForGuests.ps1:

Exception calling "ExecuteQuery" with "0" argument(s): "Oppdatering av denne tenantegenskapen er for øyeblikket deaktiv
ert."
At (...):25 char:3
+   $ctx.ExecuteQuery()
+   ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ServerException

Roughly translated to "updating this tenant property is deactivated for the time being" (GOD how I wish I could override the language setting). Anything else that need to be enabled on the tenant first?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.