Posts

Showing posts with the label C#

Create and configure Azure Functions

Image
If you want to build a single endpoint which is capable of performing business and performance critical and high available process behind the scene and at the same time it should be accessible to all the ecosystem and development approach right from Mobile to REST calls and Cloud Apps "Azure Function" has it all. Microsoft Azure as evolved(ing) to give best it can from PaaS, IaaS and Azure Functions as FaaS(Function as a Service). The biggest advantage of using Azure Function is its server-less. So, no configuration and maintenance of infrastructure is needed. In this way we can only  pay for resource we consume, But still Azure provides you the ability to configure fixed service plan for better dedicated performance for your function. So i leave it up to you to choose the plan by considering not paying for un-utilized or under utilized server cost or consumption based plan.  Create Azure Functions using Visual Studio Install "Azure Functions" template f

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

List All Servers in SharePoint Farm - C#

Image
Some times we need to login to all the servers in SharePoint farm just to restart selected Application or Site Pool. Let's see a C# code how to retrieve and recycle selected pools from all the servers in our SharePoint farm. In this series will see How to retrieve all servers in SharePoint farm using C# PS: Please check the NOTE at the very end on this post. First things first import dll's using System ; using Microsoft.SharePoint ; using Microsoft.SharePoint.Administration ; using Microsoft.Web.Administration ; Declare global variables // Global enum Variables public enum Action { Start, Stop, Invalid } ; public enum PoolType { AppPool, SitePool } ; // Global Server variable public List<string> servers = null ; // Global Pool ' s collection variables public List<ApplicationPool> appPoolCollection = null ; public List<Site> siteCollection = null ; Get All SharePoint Farm server names public