Posts

Showing posts from October, 2017

Enable/Disable SharePoint OOTB SPAlerts using PowerShell

Image
SPAlerts aka User Alerts is one of nice feature that SharePoint provides OOTB, This feature get automatically enabled once we configure SMTP Outbound mail address in Central Admin.  Basically it has 3 types of Alerts Frequency: Immediate Daily Weekly  Each runs on it own respective TimerJob in CA.User can set alerts for both List/Library level or item level for any existing and newly created SPList/Lib objects.  However, There is no UI option available in SharePoint to enable/disable this feature per User/List/Library level; Without deleting  it. But some time our requirements are never been interesting that we need to disable alerts for Specific User or All the users from specific List/Library $oWeb = Get-SPWeb "https://site.domain.com/sites/web" $oList = $oWeb .Lists.TryGetList( "Communication" ) # Get all alert # $alerts = $oWeb.Alerts | ? { ($_.List.Title -eq $oList.Title) } # Get alerts of specific frequency $alerts = $oWeb .Aler

SharePoint Server - Recycle / Stop-Start Application/Site pool using C#

Image
As a continuation of my previous post List All Servers in SharePoint Farm using C# Now w'll see to Start/Stop Pools without login to the server each time. { Please check the NOTE at the very end on this post } List All Application/Site Pools /// <summary> /// Load Pools from the given server /// </summary> /// <param name="serverName">Server name</param> /// <param name="pool">Pool type</param> public void LoadPools( string serverName, PoolType pool) { var server = ServerManager.OpenRemote(serverInstance); if (pool == PoolType.AppPool) { appPoolCollection = new List<ApplicationPool>(); appPoolCollection = server.ApplicationPools.ToList(); } else if (pool == PoolType.SitePool) { siteCollection = new List<Site>(); siteCollection = server.Sites.ToList(); } } Start/Stop Application Pool /// <summary> /// Reset Applicat