Posts

Publish files which are not published by users

#Set-ExecutionPolicy Unrestricted #Set-ExecutionPolicy RemoteSigned cls $Host.UI.RawUI.WindowTitle = "-- Publish Files --" $scriptdir = $PSScriptRoot #$DatePrefix ="XML\"+ (Get-Date).ToString("MMddyyyyHHmm") $DatePrefix ="XML\" Write-Host "Loading the CSOM library" -foregroundcolor yellow Add-Type -AssemblyName System.Web # Paths to SDK. Please verify location on your c omputer. Add-Type -Path "$scriptdir\Microsoft.SharePoint.Client.dll" Add-Type -Path "$scriptdir\Microsoft.SharePoint.Client.Runtime.dll" Add-Type -Path "$scriptdir\Microsoft.SharePoint.Client.Publishing.dll" Add-Type -Path "$scriptdir\Microsoft.SharePoint.Client.Taxonomy.dll" Write-Host "Succesfully loaded the CSOM library" -foregroundcolor green # Insert the credentials and the name of the admin site $Username="gaurav@goyal.com"; $AdminPassword=Read-Host -Prompt "Password" -AsSecureString; $AdminUrl=

Remove Deleted Site Collections from SharePoint Online

Cls Write-Host "Remove Deleted Site Collections" Write-Host "Password Please :" #Set-ExecutionPolicy RemoteSigned $username = "gaurav@goyal.com" $password=Read-Host -Prompt "Password" -AsSecureString; $siteAdminURL = "<<Main Tenent URL Here>>" Import-Module Microsoft.Online.SharePoint.PowerShell –DisableNameChecking #$securePassword = ConvertTo-SecureString $password –AsPlainText –force $securePassword=$password $O365Credential = New-Object System.Management.Automation.PsCredential($username, $securePassword) Connect-SPOService -Url $siteAdminUrl -Credential $O365Credential Get-SPODeletedSite | foreach { Write-host "Deleting " $_.Url Remove-SPODeletedSite –Identity $_.Url –Confirm:$false } Disconnect-SPOService Write-Host "Removed Site Collections"

Get All Lists with REST API and AngularJS

Image
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script>  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>        <script>          var myAngApp = angular.module('SPAngGetLists', []);          myAngApp.controller('SPAngGetListsController', function ($scope, $http) {              $http({                  method: 'GET',                  url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/Lists?$orderby=Title",                  headers: { "Accept": "application/json;odata=verbose" }              }).success(function (data, status, headers, config) {                  $scope.customers = data.d.results;              }).error(function (data, status, headers, config) {                          });          });  </script>  <div ng-app="SPAngGetLists">      <div ng-controller="SPAngGe

Auto trim row as per width in HTML

Here is the CSS for the same : .trimLine {    white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-height:27px; padding:0px; margin:0px; }

Show trusted HTML in AngularJS

angular.module('myAngApp.filters', []). filter("sanitize", ['$sce', function($sce) {   return function(htmlCode){     return $sce.trustAsHtml(htmlCode);   } }]);

Convert HTML into Plain Text in AngularJS

angular.module('myAngApp.filters', []).   filter('ConvertToPlainText', function() {     return function(text) {       return angular.element(text).text();     }   } );

Get all sites with REST API and AngularJS

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script>  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>        <script>          var myAngApp = angular.module('SPAngGetWeb', []);          myAngApp.controller('SPAngGetWebController', function ($scope, $http) {              $http({                  method: 'GET',                  url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/webs?$orderby=Title",                  headers: { "Accept": "application/json;odata=verbose" }              }).success(function (data, status, headers, config) {                  $scope.customers = data.d.results;              }).error(function (data, status, headers, config) {                          });          });  </script>  <div ng-app="SPAngGetWeb">      <div ng-controller="SPAngGetWebController" > 

List of All Site Templates with REST API and AngularJS

Here is the code which can show you how to display all site templates / custom templates with use of REST API & AngularJS in SharePoint : <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script>  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>        <script>          var myAngApp = angular.module('SPAngGetSiteTemplate', []);          myAngApp.controller('SPAngGetSiteTemplateController', function ($scope, $http) {              $http({                  method: 'GET',                  url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/getavailablewebtemplates(1033)?$orderby=Title",                  headers: { "Accept": "application/json;odata=verbose" }              }).success(function (data, status, headers, config) {                  $scope.customers = data.d.results;              }).error(function (data,