Monday 14 May 2012

Creating Custom Service Applications

I recently got some help from Amardeep Bhogal (Amar) for a project.  Rather than me re-hash the conversation take a look at his post with sample code.

"The purpose of this sample code is to provide the reader with an insight into how SharePoint 2010 Service Applications can be used to create truly distributed scalable architecture."

Source: http://code.msdn.microsoft.com/sharepoint/SharePoint-2010-Service-4dbde25b

Tuesday 1 May 2012

Storing Application Level Setting

Problem:  In a large On Premise farm holding several web applications (web app) I have multiple custom coded applications per web app. 

Initial Hypothesis:
  • Storing the custom apps config settings in the web config is at the wrong level and dangerous to modify even using SharePoint features. 
  • Using a list is an option however configuration could span site collections.  Additionally, security would need to be set and access granted to the appropriate people on the config list - still me favourite option especially when adding caching.
  • I have also use property bags but have need to maintain this via PowerShell.  A lot of developers like this option but without UI I felt it was not worth the effort to use/maintain and document this over using web.configs. 
Resolution:
The CodePlex project "SharePoint Property Bag Setting 2010" (PBS2010) is a great tool for replacing the developers technique of using the web.config.  The package is deployed at farm level and administration screens are provided on the Central Administration site for the farm.  PBS2010 can be extended to allow Site Collection administrators to edit the settings themselves but if this is required I would use a configuration list at the root SPWeb for the Site collection.  This is a nice codeplex project that I will definitely leverage going forward.


Below is a Powershell snippet to add a property to the property bag on the default SPWeb on a site collection:
$url= 'http://me.demo.dev/sites/PaulBeck'
$site = Get-SPSite($url)
$rootWeb = $site.RootWeb
$rootWeb.AllProperties.Add("Age","25")   # Sure Pal
$rootWeb.Update()
$ht = $rootWeb.AllProperties  # Display the hash table

Update 2015-12-15:  You can also append the url and view the RSS feed to see property bag values
http://me.demo.dev/sites/PaulBeck/_api/web/allproperties

Also See:
Microsoft have a very nice code block for setting and getting property bag settings.
http://msdn.microsoft.com/en-us/library/ff798340.aspx
It uses a unique naming convention which I'm not too happy with but I guess it so dev's don't accidentally modify or delete property bag setting set by the product.

Monday 23 April 2012

ISC London 2012

Monday 23/04/2012:  I missed the keynote and went to the IT Pro track sessions.  I'm not sure about this follow on format being used for the entire conference.  I prefer conferences where each session is packed with speaker tips and allows for delegates to switch between tracks.  Saying that the speakers were good and the sessions are well planned. I still have plenty to learn on the IT Pro track so looking forward to Tuesday.  Was good to see old colleagues and meet some new people.
  • Powershell build and configuration sessions were excellent.
  • SQL tips were good.
  • User Profile session was great to follow despite being way to advanced for my UPS understanding.
Tuesday 24/04/2012:  I went to the 1st 2 developer sessions with Mirjam van Olst & Waldek Mastykarz.  Nice sessions with great perspective on development.  I went to the search session and found these especially the 2nd session with Neil Hodgkinson enlightening.  For the last session of the day I went to Kimmo Forss session on migration, not a technical session but very important and I find Kimmo to be a interesting speaker to listen to.  I think the key from Kimmo's session for me is plan & analyse don't just jump in.

Summary: I am coming around to the follow on sessions idea however, I still prefer the traditional standalone barrage me with ideas approach.  It was good to listen and speak to people with a wide range of roles/experiences in SharePoint over the conference.  This is a good conference and I get a lot of information from these conferences.

Wednesday 28 March 2012

Deploying Code on Shared SharePoint Infrastructure

Problem: How do you deploy code onto your SharePoint Production farm for Enterprises. 

Initial Hypothesis: There are various options for deploying solutions on SP2010.  The stricter you are the better the farm will cope with multiple additional coded solutions.  Layout clear guidelines on:
GAC vs Bin vs Sandboxes
Scoping - minimal scoping
Upgrades - how do you upgrade, use wsp, number dll's, upgrade wsps,.
Backup and restoring site templates and moving data.  The farm you are moving a backed up Site collection to needs to be newer than the source SP version.
Customisation - do you try OOTB, are your designs vetted by an architect, SPD, InfoPath, 3rd party web parts/templates.

Resolution:
Use test, QA and production environment and update each env using the same steps/documentation.  Consider AvePoint Migration Manager (need to review this) for deploying InfoPath, assets including wsp's and code.
Ensure all architects and developers know the developer Standards for the SP2010 farm.  This should include how to deploy code, as a general rule make everything need to be deploy-able via PowerShell scripts, it's safer and can be retracted.  Developer standards need to mention; what SP features (MMS, UPS, Excel Services, ect.) can be used and what tools such as InfoPath and SPD are allowed, how are these changes synchronised between your environments/farms.  Should customisation be packaged in wsp's?  It takes time but could mean a more stable farm.  Should also cover when to code, ensuring code such as elevate privileges is used correctly, the list goes on and is a mixture of SP best practises and implementing them pragmatically for you business.

PS to deploy wsp's

Tools to look at are:
  1. ROSS from RepliWeb (Attunity) &
  2. Avepoint (Deployment Manager) has a module for deploying between environments.

Saturday 24 March 2012

Turning on the Windows 2008 R2 Desktop Experience

Problem: A standalone developer VM generally means that the developer needs to use the browser on the Windows 2008 Server to check features are working in SharePoint.  On such problem with working on the Windows 2008 desktop you can't open a document library in Windows Explorer.
Error Message: "Your client does not support opening this list with Windows Explorer.".
Your client does not support opening this list with Windows Explorer
Initial Hypothesis:
Turn on the Windows Desktop Experience feature.
Windows feature - turn on 'Desktop Experience'
Resolution:
Run the following 2 PS cmds as administrator:
PS> Import-Module Servermanager

PS> Add-WindowsFeature Desktop-Experience -restart


Note: I only apply this to me development machines.

The Desktop Experience also fixes using Office on the Dev VM.
Useful PS cmds in this area:
# Import-Module Servermanager

# Get-WindowsFeature
# See what Windows features is installed
# Add-WindowsFeature Desktop-Experience -restart
# Remove-WindowsFeature Desktop-Experience -restart

Friday 16 March 2012

Fiddler Tip - view https traffic

Problem:Need to see https traffic between the browser or any client application and the web server.

Inital Hypothesis:  Use fiddelr to trust the sites public certificate so that https traffic can be monitored.

Resolution:  Open Fiddler
Tools >Fiddler options > Https > Decrypt https traffic.  Accept the popups.




Updated 2017-06-02: Screens have changed slightly.
Update 2023-06-22: Auto responder - allows me to inject a local file instead of a network file, in the example below, I overwrite, making the developer loop much easier, and I can develop faster.
Streamline JavaScript web resource development using Fiddler AutoResponder (Developer Guide for Dynamics 365 Customer Engagement (on-premises)) | Microsoft Learn

Thursday 8 March 2012

Setting up User Profiles Reminder

Problem:  Over the last few years I have to re-setup user profiles fairly often and each time I try do it from memory and it fails.  Once again tonight I messed it up on the 1st run.

Resolution:
This Technet article on UPS is key follow the steps: http://technet.microsoft.com/en-us/library/ee721049.aspx
Good simple video on setting up the AD connection and synchronising the UPS http://www.microsoft.com/resources/technet/en-us/office/media/video/video.html?cid=stc&from=mscomSTC&VideoID=04fc6247-66ae-4902-9e5e-7c6fd030ef0f

More Info:

PowerShell to determine NetBios/Hostname and FQDN on the local machine:
PS> $obj_IPProperties = [System.Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties()
PS> "FQDN: {0}.{1}" -f $obj_IPProperties.HostName, $objIPProperties.DomainName
PS> $obj_Computer = Get-WmiObject -Class Win32_ComputerSystem
PS> "NetBios: {0}" -f $obj_Computer.Name