zoukankan      html  css  js  c++  java
  • sharepointOnline的外接应用创建

    #CODE STARTS HERE
    
    $programFiles = [environment]::getfolderpath("programfiles")
    
    add-type -Path $programFiles'SharePoint Online Management ShellMicrosoft.Online.SharePoint.PowerShellMicrosoft.SharePoint.Client.dll'
    
    Write-Host 'To enable SharePoint app sideLoading, enter Site Url, username and password'
      
     $siteurl = Read-Host 'Site Url'
      
     $username = Read-Host "User Name"
      
     $password = Read-Host -AsSecureString 'Password'
      
     if ($siteurl -eq '')
     {
         $siteurl = 'https://mytenant.sharepoint.com/sites/mysite'
      
         $username = 'me@mytenant.onmicrosoft.com'
      
         $password = ConvertTo-SecureString -String 'mypassword!' -AsPlainText -Force
      
     }
          $outfilepath = $siteurl -replace ':', '_' -replace '/', '_'
      
     try
     {
         [Microsoft.SharePoint.Client.ClientContext]$cc = New-Object Microsoft.SharePoint.Client.ClientContext($siteurl)
      
         [Microsoft.SharePoint.Client.SharePointOnlineCredentials]$spocreds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
      
         $cc.Credentials = $spocreds
         
          Write-Host -ForegroundColor Yellow 'SideLoading feature is not enabled on the site:' $siteurl
          
          $site = $cc.Site;
          
             $sideLoadingGuid = new-object System.Guid "AE3A1339-61F5-4f8f-81A7-ABD2DA956A7D"
          
             $site.Features.Add($sideLoadingGuid, $false, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None);
          
             $cc.ExecuteQuery();
          
             Write-Host -ForegroundColor Green 'SideLoading feature enabled on site' $siteurl
         #Activate the Developer Site feature
     }
      
     catch
      
     { 
         Write-Host -ForegroundColor Red 'Error encountered when trying to enable SideLoading feature' $siteurl, ':' $Error[0].ToString();
     }
    
    #CODE ENDS HERE



    安装sharepointonlinemanagementshell_English_x64.msi
    执行以上脚本,按提示输入url,username,password.

      

  • 相关阅读:
    动手动脑篇之类与对象
    团队精神
    在快乐中学习
    实习报告
    大道至简读后感(二)
    大道至简读后感
    读《大道至简》第一章有感
    指令随笔之:tail、cat、scp、&、&&、;、|、>、>>
    NFS安装过程
    CentOS7编译安装Nginx-1.8.1和编译参数
  • 原文地址:https://www.cnblogs.com/shiningleo007/p/10245162.html
Copyright © 2011-2022 走看看