SharePoint Online – List of Sites & Webs

Scenario:

Need to create a PowerShell script that iterates through all SharePoint Online site collections and webs and generate info. regarding site collection size, last time site/web update and other.

Resolution:

Tweaked script by Jose Quinto @ https://blog.josequinto.com/2016/03/17/using-powershell-to-retrieve-all-sites-web-object-recursively-from-sharepoint-online/.

Output is two CSV files in temp folder on C drive root. One with the details and other with site collection on which account gets 401 error.

$Global:webinfo = @()

function AuthenticateUserProfile($siteUrl, $tenantAdmin, $secureAdminPassword)
{
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($tenantAdmin, $secureAdminPassword)
$ctx.Credentials = $credentials
return $ctx
}

function RecursiveWebs($ctx, $web){

foreach($w in $web.Webs)
{
$ctx.Load($w.Webs);
$ctx.ExecuteQuery();

$Properties = @{
Title = $w.Title
URL = $w.Url
NoOfSubsites = $w.Webs.Count
LastUserModifiedDate = $w.LastItemUserModifiedDate
LastItemModifiedDate = $w.LastItemModifiedDate
SiteCollection = ‘No’
SiteOwner = $w.Author.Title
}

$Global:webinfo += New-Object psobject -Property $properties

if ($w.Webs.Count -gt 0)
{
RecursiveWebs $ctx $w
}
}
}

$username = “adm@test.com”
$password = ConvertTo-SecureString “PASSWORD” -AsPlainText -Force
$O365Credential = New-Object System.Management.Automation.PsCredential($username, $password)

#SharePoint Online Admin site URL
Connect-SPOService -Url https://test-admin.sharepoint.com -Credential $O365Credential
$sites = Get-SPOSite -Limit All -Detailed

foreach ($site in $sites)
{
if(
$site.Url.Equals(“https://test.sharepoint.com/sites/new”) -or
$site.Url.Equals(“https://test.sharepoint.com/search”)
)
{
continue;
}

Write-Host $site.Url
try
{
$ctx = AuthenticateUserProfile $site.Url $username $password;
$web = $ctx.Web
$ctx.Load($web)
$ctx.ExecuteQuery()
$ctx.Load($web.Webs)
$ctx.ExecuteQuery()

$Properties = @{

Title = $site.Title
URL = $site.Url
SiteSizeLimitInMB = $site.StorageQuota
SiteUsageInMB = $site.StorageUsageCurrent
NoOfSubsites = $web.Webs.Count
SiteOwner = $site.Owner
LastContentModifiedDate = $site.LastContentModifiedDate
LastUserModifiedDate = $web.LastItemUserModifiedDate
SiteCollection = ‘Yes’
LastItemModifiedDate = $web.LastItemModifiedDate
}

$Global:webinfo += New-Object psobject -Property $properties

if ($web.Webs.Count -gt 0)
{
RecursiveWebs $ctx $web
}
}
catch
{
Write-Host $_ -ForegroundColor Red
$Properties1 = @{

Title = $site.Title
URL = $site.Url

}

$site401 += New-Object psobject -Property $properties1

}

}

$webinfo | Select-Object Title, URL, SiteSizeLimitInMB, SiteUsageInMB, LastItemModifiedDate,
LastUserModifiedDate, LastContentModifiedDate, NoOfSubsites,
SiteOwner, SiteCollection | Export-Csv -notypeinformation -Path ‘C:\temp\SPOinfo.csv’

$site401 | Select-Object Title, URL | Export-Csv -notypeinformation -Path ‘C:\temp\SPOinfo401.csv’

 

Leave a Comment

SharePoint Online – Synch is not working

Scenario:

Installed Office 2016 on computers and unable to Synch document libraries

Resolution:

First check the version of OneDrive. Please make sure when press synch, exe should be running OneDrive.exe not groove.exe. If OneDrive.exe is running, please make sure OneDrive sync client must be version 17.3.6674.1021 or higher. If not, please follow steps:

  1. Download and install the preview build of the new OneDrive sync client.
  2. Download and open TeamSiteSyncPreview.reg to enable SharePoint document library sync.
  3. Restart computer
  4. Use Chrome to Synch document library.

Source:

https://support.office.com/en-us/article/Transition-from-the-previous-OneDrive-for-Business-sync-client-for-SharePoint-sites-887b9846-2192-4511-9311-de562ef64076

https://support.office.com/en-us/article/Get-started-syncing-SharePoint-sites-with-the-new-OneDrive-sync-client-Preview-6de9ede8-5b6e-4503-80b2-6190f3354a88?ui=en-US&rs=en-US&ad=US

Comments (1)

SharePoint: You cannot deploy this solution on this type of server computer as it is configured. This solution must be installed on a server of type: front-end Web server

Scenario:

We tried to deploy wsp via Visual Studio 2013 on our development server, deployment stopped with following error:

You cannot deploy this solution on this type of server computer as it is configured. This solution must be installed on a server of type: front-end Web server

We tried using PowerShell, but it hangs at “Deploying”. Tried solution like adding “loopback check” but it didn’t work in case of wsp deployment.

Resolution:

Finally, disconnecting and connecting configuration database did the trick but at the cost of creating new CA.

Steps are:

  1. Run cmdlet to disconnect configuration database
  • Disconnect-SPConfigurationDatabase –Confirm:$false
  1. Close PowerShell window and open new PowerShell window
  2. Run cmdlet to connect configuration
  • $passphrase = ConvertTo-SecureString -String “sharepoint@2013” -asPlainText -Force
  • Connect-SPConfigurationDatabase -DatabaseServer SQLServerInstanceName -DatabaseName SharePoint_Config -Passphrase $passphrase
  • Start-Service SPTimerv4
  1. Run SharePoint Configuration wizard and created new central administration.

We were able to deploy solutions via Visual Studio but newly created Central Administration need to deploy every wsp.


Leave a Comment

SharePoint 2013 Migration: User not able to access after migration from SharePoint 2010 to SharePoint 2013

Scenario:

We have migrated our sites from SharePoint 2010 to SharePoint 2013. After migration, users are not able to access newly migrated site. If we delete user and provide access again, user able to access site. (Fortunately, this was happening on test migration)

Resolution:

The missing link was warning that we overlooked. When we ran PowerShell Test-SPContentDatabase cmdlet, we missed following warning:

Category : Configuration

Error : False

UpgradeBlocking : False

Message : The [SharePoint2013] web application is configured with claims authentication mode however the content database you are trying to attach is intended to be used against a windows classic authentication mode.

Remedy : There is an inconsistency between the authentication mode of target web application and the source web application. Ensure that the authentication mode setting in upgraded web application is the same as what you had in previous SharePoint 2010 web application. Refer to the link http://go.microsoft.com/fwlink/?LinkId=236865 for more information.

Locations :

In other words, SharePoint 2013 discourage classic mode authentication. If web application is created via Central Administration, claim based is the default and preferred method of authentication. If want to create web application with classic mode authentication, you need to use PowerShell cmdlets.

It goes like this:

  1. Create classic mode web application using PowerShell cmdlets
  2. Attach all content database with web application
  3. Convert classis mode web application to claim base authentication
  4. Configure Object cache

Create classic mode web application using PowerShell cmdlets

$ap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication –DisableKerberos

New-SPWebApplication -Name “SharePoint – 2013” -ApplicationPool “SharePoint 2013 Web Apps” -ApplicationPoolAccount (Get-SPManagedAccount “domain\login”) -Port 80 -Url http://sharepoint2013 -AuthenticationMethod NTLM -AuthenticationProvider $ap -DatabaseName “WSS_Content_01”

Attach all content database with web application

Mount-SPContentDatabase “WSS_Content_2” -DatabaseServer “SQLDB2013” -WebApplication http://sharepoint2013

Convert classis mode web application to claim base authentication

Convert-SPWebApplication –Identity http://sharepoint2013 –To Claims -RetainPermissions –Force

Configure Object cache

$wa = Get-SPWebApplication -Identity http://sharepoint2013

$wa.Properties[“portalsuperuseraccount”] = “domain\login”

$wa.Properties[“portalsuperreaderaccount”] = “domain\login”

$wa.Update()

Make sure you enter user login using SharePoint 2013 claims encoding. It must be in this format “i:0#.w|contoso\chris” [For details, please visit] and don’t forget to restart IIS.


Leave a Comment

Nintex Workflow: Remove / Delete Custom Actions

Scenario:

We have created a lot of custom actions and wanted to remove some custom actions that are created for POC purpose only.

Resolution:

For Nintex Workflow 2010,

  • Using windows powershell go to, “C:\Program Files\Nintex\Nintex Workflow 2010” or “C:\Program Files (x86)\Nintex\Nintex Workflow 2010”
  • Run NWAdmin.exe with switches -o RemoveAction -adapterType <namespace.class of adapter> | -id <id of action>
  • One way of finding ID of Custom Action is accessing Nintex database and looking into table “Activities”. In this table you will be able to find all details related to custom activities.

For Nintex Workflow 2013,

  • Path of NWAdmin.exe changes to “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\BIN”

Leave a Comment

SharePoint 2013: Create Master Page using Visual Studio 2012

Scenario:

You can find many blogs on how to create SharePoint 2013 master page in Visual Studio 201. We faced following issue while creating master page. Long story, we need to create master pages for our new SharePoint 2013 environment. As with our previous experience, we decided to create them in Visual Studio. Everything works fine but when we try to deploy wsp via Visual Studio 2012, master pages are not uploaded in “Master pages and Layout Library”. The problem was in the XML that was written in “Elements.xml” file.

Resolution:

Before moving to XML that worked, we would like to share all the XML that didn’t worked. We are not sure why they didn’t work. Perhaps, anything wrong on our side.

XML that didn’t work:

<Elements
xmlns=http://schemas.microsoft.com/sharepoint/>

<Module Name=MasterPages” RootWebOnly=TRUE >

<File Path=MasterPages\ABCIntranet.master” 

Url=_catalogs/masterpage/ABCIntranet.master” 

IgnoreIfAlreadyExists=true >

<Property Name=UIVersion” Value=15></Property>

</File>

</Module>

</Elements>


<Elements xmlns=http://schemas.microsoft.com/sharepoint/>

<Module Name=MaterPage” Url =_catalogs/masterpage” List=116>

<File Path=MaterPage\ABCIntranetMasterPage.master” 

Url=ABCIntranetMasterPage.master
Type=GhostableInLibrary” IgnoreIfAlreadyExists=FALSE />

</Module>

</Elements>


<Elements xmlns=http://schemas.microsoft.com/sharepoint/>

<Module Url=_catalogs/masterpage” Name=MasterPage>

<File Url=ABCIntranetMasterPage.master” Type=GhostableInLibrary
IgnoreIfAlreadyExists=TRUE” 

Path=MasterPage\ABCIntranetMasterPage.master/>

</Module>

</Elements>

XML that did work is:

<Elements xmlns=http://schemas.microsoft.com/sharepoint/>

<Module Name=MasterPage” List=116” Url=_catalogs/masterpage
Path=MasterPage” RootWebOnly=TRUE>

<File Url=ABCIntranet.master” Type=GhostableInLibrary >

<Property Name=UIVersion” Value=15 />

</File>

</Module>

</Elements>

Leave a Comment

Older Posts »