About Me

My photo
JHC Technology is a Service Disabled, Veteran-Owned, Small Business based in the Washington, DC Metro area. Our primary focus is to offer customized solutions and IT consulting to our Commercial and Government clients. Our experts have a broad experience delivering and managing Microsoft Enterprise applications and Cloud and Virtualization Solutions, as well as mobilizing Enterprise data.
Showing posts with label Development. Show all posts
Showing posts with label Development. Show all posts

Tuesday, November 12, 2013

Hybrid Cloud Solutions: Amazon Web Service (AWS) and Microsoft Office 365


Can Microsoft Office 365 and Amazon Web Services (AWS) work together?  The answer to this cloud riddle is YES.  

There seems to be an overall confusion between what these Cloud venders provide as services.  To be clear, Amazon Web Services is an Infrastructure as a Service (IaaS) provider and Microsoft Office 365 is a Software as a Service (SaaS).  

In enterprise deployments of Office 365, many organizations have requirements to manage and synchronize user profiles to Office 365, restrict user access, provide secure mobile access, and advanced Exchange/Lync/SharePoint management (Remote PowerShell and management consoles).  

In order to satisfy these requirements, organizations will need to deploy the following components within their controlled environment:
  • Mobile Management Solution (Blackberry Enterprise Server 10)
  • Active Directory Federation Services (ADFS) internal and proxy
  • Exchange and Lync Management Console
  • Remote PowerShell for SharePoint, Exchange, Lync, and other Office 365 components

Some of our clients have elected to move these components into their own Virtual Private Cloud (VPC) within Amazon Web Services (AWS) so that they can take advantage of the power of AWS (Elastic, Pay as you go model, network, high availability, etc…) and remove their dependencies on managing their own data centers. Once these components have been deployed they can be configured to integrate/communicate with Office 365 Exchange, SharePoint, Lync, and other Office 365 components.

JHC Technology has also designed and implemented virtual application and desktop technology to run on Amazon Web Services.  We are able to deploy the Microsoft Outlook virtual application as well as other office products on AWS and connect them to Office 365.  In this scenario, users are able to connect to an AWS region and access Outlook either via virtual desktop or virtual application from any device and pull down their Office 365 exchange mail securely.

Organizations should not be tied down to use only one cloud model (IaaS vs SaaS). They should look at their overall requirements and choose an architecture that is flexible enough to expand for future requirements.

James Hirmas is the CEO for JHC Technology.  He can be reached at jhirmas(at)jhctechnology.com,@JHC_JamesHirmas, or connect with him on LinkedIn.

Friday, May 31, 2013

How to Add and Remove Entries From Web.Config Using SPWebConfigModification

Often times during SharePoint Development, we need to store configuration related entries in the web.config file. We can use Property Bag tool from CodePlex, but in case you would like to use a Feature, I have outlined below the steps to create a Feature that will add entries to the web.config for the SharePoint Web Application:

1.       Open Visual Studio 2010
2.       Select New Project  Empty SharePoint Project
3.       Provide a local site and Select "Deploy as a farm solution" option.


4.       Right Click on the "Features" and Select "Add Feature"


5.       On the following screen, provide the Unique Title Name and Description. (Refer to screen below).

(Mostly, developers don't put anything in Description but this information really comes in handy when you are trying to figure out what a specific Feature is supposed to do in terms of functionality)
6.       Right Click on Feature1.Feature and Click on "Add Event Receiver"
7.       Uncomment the "Feature Activated" part of the code


8.       Add the following Code in FeatureActivated Method

This code is added to the following entries in web.config
  1. Connection Strings
  2. Key Value pair in AppSettings section
For each child node entry provide a specific owner name (like "Smartrider" in my case).We will need this as a reference later on in case you want to remove the entries (we are going to do this during Deactivation)
string value = @"Test"
SPWebApplication webApp = SPWebApplication.Lookup(new
Uri("<URL>"));
SPWebService service = SPWebService.ContentService;
SPWebConfigModification connMod = new
SPWebConfigModification();
connMod.Path = "configuration";
connMod.Name = "connectionStrings";
connMod.Value = " <connectionStrings> </connectionStrings>";
connMod.Owner = Assembly.GetExecutingAssembly().FullName;
connMod.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureSection;
webApp.WebConfigModifications.Clear();
webApp.WebConfigModifications.Add(connMod);
//SQL Connetion String
SPWebConfigModification webConfigMod = new
SPWebConfigModification();
webConfigMod.Owner = "Smartrider";
webConfigMod.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
webConfigMod.Value = String.Format("<add name=\"{0}\" connectionString=\"{1}\" providerName=\"{2}\"></add>", "conn", "Data Source=<datasource>;Initial Catalog=<databasename>;Integrated Security=True", "System.Data.SQLClient");
webConfigMod.Path = "configuration/connectionStrings";
webConfigMod.Name = "sqlConn";
webApp.WebConfigModifications.Add(webConfigMod);
//Add NetworkShare URL
SPWebConfigModification appConfigMod = new
SPWebConfigModification();
appConfigMod.Owner = "Smartrider"
appConfigMod.Path = "configuration/appSettings";
appConfigMod.Name = String.Format("add [@key='NetworkURL'] [@value='{0}']", value);
appConfigMod.Value = String.Format("<add key='NetworkURL' value='{0}' />", value);
appConfigMod.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
webApp.WebConfigModifications.Add(appConfigMod);
webApp.Update();
service.ApplyWebConfigModifications();
  • You also want to add code to remove the entry when the Feature is Deactivated. One way to do this is to find all the entries that are inserted by Owner name "Smartrider".
public
override
void FeatureDeactivating(SPFeatureReceiverProperties properties)
{
SPWebApplication webApp = SPWebApplication.Lookup(new
Uri("URL"));
try
{
RemoveEntries(webApp);
webApp.Update();
webApp.Farm.Services.GetValue<SPWebService>().ApplyWebConfigModifications();
webApp.WebConfigModifications.Clear();
}
catch (Exception ex)
{
throw ex;
}
}
//Remove Entries made to web.config by Owner name "Smartrider"
private
void RemoveEntries(SPWebApplication webApp)
{
try
{
List<SPWebConfigModification> entriesToRemove = new
List<SPWebConfigModification>();
foreach(SPWebConfigModification configMod in webApp.WebConfigModifications)
{
if(configMod.Owner == "Smartrider")
{
entriesToRemove.Add(configMod);
}
}
if(entriesToRemove.Count > 0)
{
for (int i = entriesToRemove.Count - 1; i >= 0; i--)
{
webApp.WebConfigModifications.Remove(entriesToRemove[i]);
}
}
}
catch
{
throw;
}
}
9.     Deploy the code and check the web.config file to verify your entries.
10.   Done

Hemant Datta is the COO  for JHC Technology.  He can be reached at hdatta(at)jhctechnology.com, @hdatta, or connect with him on LinkedIn.