The Granite State Hacker

Microsoft.Graph and Appointment Management

It’s been a minute since I’ve felt like there was some content to share of a coding variety, and ironically, I don’t have a minute to do it. So without further ado, I’ll dig right in.

In the management of Granite State Code Camp, I devised a way to connect with all the folks who had ever been a part of one of the events I’ve hosted in Teams. I sent a calendar invite as a 1:1 meeting initiation from myself to each of all the guests in the tenant, using Graph.

This goes back to 2020, when Granite State Code Camp rode out the pandemic as an online-only event, hosted entirely in Teams. Having hosted both GSCC and the Manchester Community College’s New Hampshire CyberSecurity Symposium in the same tenant every year since, there’s a good number of guests in the tenant that all represent a decent targeted mailing list for such events.

In the meantime, while Microsoft has done a fantastic job of touting CoPilot for Visual Studio, I found that Copilot had no understanding of the latest Graph libraries. How ironic that the immense greatness of Copilot stumbles on the immense greatness of new library updates, but that’s something to explore in another post.

While the invitation automation code is messy, and not clean enough for publishing, I was then in a situation where I had a bunch of calendar invitations, and it was really hard to figure out who had accepted, who had declined, and who had ignored.

So, I wrote a console utility to find and filter all the invitations, so that I could then follow up appropriately. This code will eventually become the basis of a re-write for the invitation itself, because I like the updates to the Graph API (which I didn’t use in the part that sends the invitations). Anyway, here’s the GitHub hosted Gist including the project file that shows the package/versions I used to arrive here.

Retrospectives, Tech in the 603, The Granite State Hacker

Context is for Kings

A retrospective in software development methodology is a look back at a project cycle. Usually, a retrospective refers to a formal meeting held at the end of a development cycle. Retrospectives provide context for where you are, and can help you figure out where course adjustments might be needed.

I’m going to start a series of project retrospective blog posts. My intent is to go a bit beyond the standard “lessons learned” aspect of a classic case study by discussing ways to address those lessons learned if I were delivering on the same requirements today.

I understand there’s some risk in this. The very nature of talking about “what I’d do different today” is a dynamic target. The answer could be different tomorrow, when you’re reading this. Perhaps that’ll be another chance to revisit the topic.

In these posts, I’m going to go over my own project history and do a full post-mortem on whole project deliveries. In order to protect potential client property, I’ll generally avoid identifying the client I did the work for and/or any publicly known project name. Teammates familiar with the projects will be able to identify them, but that’s ok.

Whenever working on a longer-term, non-trivial application, it’s inevitable that before the project is completed, technical debt sets in. Most commonly, some of the components are obsoleted by newer versions of tools used in the project, and there’s no immediate need or budget to update it. As long as those tools are still supported, it’s generally de-prioritized as a problem for another day. Longer term, everything is eventually obsoleted.

Another inevitable part of code development is the classic “if I had it to do over again” aspect. This is a big-picture extension on the old “Make it work, make it right, make it fast” practice. The first time through a project, there’s always “make it work” moves that end up being what gets delivered, without opportunity to get to the “make it right” / “make it fast” cycles. If I had the project to do over again, I’d “make it more right” or “make it faster” by doing ‘X’.

Likewise, every project cycle has its ups and downs in terms of team interaction. Some times folks are on the ball, and the code flows. Other times, there’s what we call blockers… things that hold up progress.

A blocker could be any number of things.

A common blocker is missing or incomplete requirements. It’s hard for a programmer to teach a computer to do work if the programmer doesn’t know how to do that work.

Another common blocker is access or permissions. A programmer might have a requirement to develop code that depends on another service. If that’s the case, the programmer might be able to build an abstraction of that service, but eventually will need permission to access that service in some form to do integration testing.

In this case, I’ll still take the classic retrospective approach. I’ll address the following questions:

  • What did we set out to do?
  • How and why did we deviate from plan?
    • What worked?
    • What didn’t work?
  • What would we like to do next time?
    • How could we improve what worked?
    • How will we minimize the risks of what didn’t work?
    • How will we address any technical debt incurred?

Some retrospectives avoid management in order to avoid addressing these questions politically. In better situations, some representative of management and/or project stakeholders are included in order to get a more complete view of the project.

In my posts on the topic, it’ll just be my perspective, and I’ll be addressing the questions holistically. Having completed the projects and disbanded the delivery teams, with minor name changing to protect the innocent, politics need no longer apply.

I’ll admit, there’s some self-gratification in doing these post-mortems publicly. I’ll be able to show off experience, and hopefully grab the attention of folks who’d like to produce similar projects. My hope is to inspire more of the latter and spark up the conversation around how to apply similar solutions (preferably with the “desired state” improvements).

Tech in the 603, The Granite State Hacker

v.Next Enterprise (You & Kroger)

krogerI ran across this article from Forbes on LinkedIn.  It’s an interesting bit about how Kroger is reacting to the threat that Amazon/Whole Foods suddenly represents in its market segment.

The Amazon/Whole Foods merger represents a heavily modernized re-make of a traditional business, and it is expected to put grave pressure on the rest of the grocery segment.

If your market segment isn’t feeling this kind of pressure already, you likely will be soon.

Your business has only a couple of choices when it comes to modernization.

  1. React to the pressure that your market segment is under already.
  2. Begin preemptively, and be the pressure the rest of your market segment feels going forward.

I remember the days of building “nextgen” software.  That model has scoped up a few times, to vNext services, to next gen infrastructure / cloud, to vNext IT division.

Either way, it’s time to start developing your company’s “nextgen enterprise” strategy.



Tech in the 603, The Granite State Hacker

Need to Synchronize Columns of a Master/Detail Grid in DevEx WPF?

I generally prefer Telerik controls, but I’ve got a client that uses Developer Express.  I recently had a need to synchronize columns in a Developer Express WPF Master/Detail grid.   It’s a bit of an unusual circumstance, where we have Master / Detail records that use the same view interface, but found the TreeListControl unable to scale up to the demands of our use cases.  The client still wanted the detail grid’s columns to appear to functionally be the same column as the master record’s (with the ability to show/hide the detail).

Thankfully, the Dev Express GridColumn class is a DependencyObject, and all the needed properties are exposed as DependencyProperty’s.

Since the detail grid has the same data interface as the master grid, I was even able to clone the column definitions. 

Finally, since this was an MVVM project, I didn’t want the functionality in code-behind, so I abstracted the code for this into a Behavior.

The approach was to bind the Width, Visibility, and VisibleIndex properties of each master grid column to a cloned detail grid column, giving the two entities the appearance of being one functional entity.
Here’s the snippet representing the detail grid definition….



                <dxg:DataControlDetailDescriptor ItemsSourceBinding="{Binding Details}">

                    <dxg:GridControl x:Name="DetailsGrid" AutoGenerateColumns="None" ColumnsSource="{StaticResource ColumnsCollection}" >

                        <dxg:GridControl.View    >

                            <dxg:TableView  AutoWidth="False"













                            RowStyle="{StaticResource RowStyle}"

                            AlternateRowBackground="{x:Static dxRes:DevExpressResources.AlternateRowBackgroundBrush}"












Note the highlighted part above that introduces a local class called SyncDetailGridColumsBehavior, shown in its entirety below:

using System.Windows.Data;

using System.Windows.Interactivity;

using DevExpress.Xpf.Grid;

namespace Local
    public class SyncDetailGridColumnsBehavior : Behavior<GridControl>
        private GridColumnCollection_parentGridColumns;
        private GridColumnCollection_detailsGridColumns;
        protected override void OnAttached()
            _detailsGridColumns = AssociatedObject.Columns;
            _parentGridColumns = AssociatedObject.ResolveParentColumnCollection();
        private void InitializeMasterDetailGrid()
    internal static class ColumnHelpers
        public static GridColumnCollectionResolveParentColumnCollection(this GridControl associatedObject)
            var result =
                    ((System.Windows.FrameworkContentElement) associatedObject.Parent).Parent).Columns;
            return result;
        public static voidCloneColumnsAndBindWidthsFrom(this GridColumnCollection targetGridColumns,
            GridColumnCollection sourceGrid)
            foreach (var aSourceColumn in sourceGrid)
                var aClonedColumn = aSourceColumn.Clone();
        public static GridColumn Clone(this GridColumn source)
            return new GridColumn()
                Name = source.Name,
                Width = source.Width,
                Binding = source.Binding,
                Header = source.Header,
                Style = source.Style,
                CellStyle = source.CellStyle,
                CellTemplateSelector = source.CellTemplateSelector,
                CellTemplate = source.CellTemplate,
        public static void BindWidths(this GridColumn source, GridColumn bindingPartner)
                new Binding(“ActualWidth”)
                    Source = bindingPartner,
                    Mode = BindingMode.OneWay,
                    UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
                new Binding(“ActualWidth”)
                    Source = source,
                    Mode = BindingMode.OneWay,
                    UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
        public static void BindPositions(this GridColumn source, GridColumn bindingPartner)
                new Binding(“VisibleIndex”)
                    Source = bindingPartner,
                    Mode = BindingMode.TwoWay,
                    UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
        public static void BindVisibility(this GridColumn source, GridColumn bindingPartner)
                new Binding(“Visible”)
                    Source = bindingPartner,
                    Mode = BindingMode.TwoWay,
                    UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged

I expect this to cover 90% of our needs, the other 10% has to do with row selection across master/detail boundaries, but that’s a story for another day.

In the meantime, let me know how this makes ya feel…  leave a comment, below.


Tech in the 603, The Granite State Hacker

Time to Extend Your Brand to Windows 10

Marketers, if you’re looking for fresh, fertile ground to extend your brand into, jump now on Windows 10.

The Windows 10 app store is a clear path to:

  • Bump up your online store shopper counts
  • Extend ever-available services directly to your Windows customers (which is about 90% of them)
  • Connect with your brand’s demographic in a way that helps you better understand their needs
  • Build brand value by connecting with partners
  • Build brand value by connecting with social media
  • Escape web browser inconsistency that threatens to pull brand value down
  • Escape security/stability issues in popular platforms (e.g. Android) that threatens brand value.
  • Reach more device form factors with a single, less specialized (less expensive) codebase (desktop, tablet, phone, even game consoles and devices)


Windows 10 is attracting Microsoft’s (and, by extension, arguably) consumer tech’s most valuable territory,

To wrap one’s head around this, it helps to understand recent history a bit. 

Being a “convicted monopoly” put a lot of costly restrictions on Microsoft, and especially Windows, making every OS release from XP to Vista to Windows 7 less than it could have been.  Despite the fact that Windows is still king in the desktop arena by far, Microsoft has done a great job of digging out from under the perception that it has a monopoly in that space.  It dug itself out by connecting Windows to the both to the cloud and to the broader computing device market, including tablets, smartphones, consoles and devices.

Being out from under those restrictions has enabled Microsoft to really make Windows 10 come together in ways that even the incumbent Windows 7 couldn’t.   All indications are that Windows 10 is a hit and will de-throne Windows 7 as the de-facto desktop OS within a couple years. Between re-claimed freedom to innovate, lessons learned, and other market conditions, it’s a no-brainer that Windows 10 has legs.

[Here’s a number to associate with Windows 10:  1 Billion UPGRADES.  (not counting the number of devices that will be sold with Windows 10 on them.)]

What about Social Media?  According to folks like @fondalo:

With nearly 62% of consumers stating that social media has “no influence at all” on their purchasing decisions (Gallup), marketers are faced with substantial hurdles in an ever-increasingly noisy digital landscape. This challenge is further amplified by a CMO Council study showing that only 5 percent of brands feel they are extremely effective at creating experiences that resonate with target audiences.

In fact, most marketers are currently forced to put more resources toward their digital and social efforts, just to maintain their current returns. I believe this gap will continue to widen for larger brands, but smaller more nimble retailers that get creative and deploy proper resources could end up being the big winner.

Finally, it goes without saying that it no longer matters that you’ve extended your brand to iOS (iPhone/iPad) and/or Android.  The app marketplace for those devices, in your space, is saturated… even super-saturated.  You’ve extended your brand to those app stores, and so has every other brand in the world, including all your competitors.   Of course, saturation will occur in the Windows 10 app marketplace, but getting in ahead of the crowd has its advantages.

Never mind the upside potential on phones and tablets (which remains huge, and far more addressable from Windows 10).  The pendulum is swinging back to the desktop/laptop again (for now).

Being a Microsoft appointed Technical Solutions Professional, I can help.  Let me know how I can bring my (and my team, BlueMetal‘s) expertise to bear for you in your goal to make the jump.
In any case, talk to me.  If you’re a marketing technology manager, what do you see as the pros and cons of jumping into the Windows app pool?  
Tech in the 603, The Granite State Hacker

Data Persistence in Windows Universal (8.1) apps (Boston Code Camp 23)

Thanks to everyone who joined me for my Boston Code Camp 23 presentation.  Shuffling data around is a core responsibility of any serious computing platform.  Windows Universal really goes above and beyond the mundane call of duty with consistency and utility. It’s part of what makes the Windows client platform a true “cloud car”, especially with its Backup, Roaming Settings / Folders, and Roaming Password Vault capabilities as native functionality… all from the Windows.Storage namespace.

Here are

For the individual who asked what encryption level the Windows Password Vault functionality uses, I looked it up, and it’s 128bit AES encryption.  Stern stuff there.

Another question came up about app backups.  As I said in the presentation, the content of the Local storage is backed up automatically to the cloud by the OS.  (Isn’t that fantastic?!)

Likewise, as mentioned, the Temporary storage is excluded from backups.

One detail I missed however… the LocalCache storage area.  LocalCache is like Local except that it is not backed up.  LocalCache differs from Temporary storage in that the OS will not wipe it as it occasionally does the Temporary storage.  Next time I do this presentation, I’ll make sure to update it to discuss LocalCache.

Here’s a comparison of the storage options available to developers in the 8.1/universal platform. Note that each user on a device gets their own app-specific sandbox *and* OneDrive space for each installed app.

Type Availability Limits Settings hashtable Backed Up By OS Sync’d to all App / User / Devices by OS Encryption Wiped By OS if space is low Uri prefix Suggested use
Install Package Universal Static/ReadOnly Media from Install No No No Sandboxed No ms-appx:// Version specific static app media
Local Universal Available free storage Yes Yes No Sandboxed No ms-appdata:///local/ General
Local Cache Windows Phone Only Available free storage Yes No No Sandboxed No   Persistent cache
Temporary Universal Available free storage Yes No No Sandboxed Yes ms-appdata:///temp Semi-persistent cache
SD/Removable Universal Available free storage No No No None No   Removable/general
Roaming Universal 100k Yes (by virtue of roaming) Yes Cloud Partitioned No ms-appdata:///roaming Roaming settings
Password Vault Universal 100k (included in Roaming) Password-friendly structure (by virtue of roaming) Yes Cloud Partioned + 128bit AES No   Roaming credentials /OAuth tokens

I asked my stunt audience (the kids) later what my presentation had been about.  I was glad to know at least one of them had gotten it right. 

They were inspired, though, and that’s the important part. 

I hope you found inspiration in technology from both the day and maybe in some small part from my presentation.

Tech in the 603, The Granite State Hacker

Lumia Problems

I’m a pretty serious fan of Windows Phone, and especially Lumia devices.   In addition to the NH Windows Phone Users Group (now Granite State Windows Platform App Devs),  I’ve convinced everyone in my immediate family, and a good chunk of my extended family to go Lumia… 

So it breaks my heart when I see a Windows Phone that’s gone awry.  Among the many I’ve come in contact with, I’ve seen one or two develop issues that seem outside of normal hardware wear & tear.

My own device has occasionally had trouble with its SD card, occasionally forcing a restore.   These are annoyances to me, Windows Phone is a cloud car, so resetting the device and getting it back to normal is really only a mater of re-entering credentials, and the phone’s back in business.   The restore tends to re-apply start-screen layout and the set of installed apps on the device… the apps themselves are responsible for their individual recoveries, typically from their own cloud backups.   The few times I’ve been forced to do a full hard reset & restore, it’s been an ordeal that typically lasted under an hour (with a good Wifi connection).

This past week, I think the SD card flaked out again, but restoring from a backup didn’t resolve the issues.   I identified a number of odd behaviors, and was almost convinced my device was beyond recovery:

  • Power button:  the typical short-click which should toggle the device in & out of standby mode simply was not operating.   Long clicks, intended to shut the device down completely, were working, so… not a hardware disconnect.   In order to wake the phone up, I had to plug in a power source… and then had to wait for it to put itself to sleep.
  • App updates:  app updates were identified and the device would queue them, but rather than automatically downloading and installing, they’d hang in the download queue, all marked as Pending.  Occasionally one would come up with an error, but a retry would simply hang it back in Pending state.
  • WiFi internet sharing would not allow clients to connect.
  • Power saver:  on a whim, I put the device in power saver mode.  At first, it wouldn’t take the change.  Then I told it to always go in powersaver mode, and then, ironically, I couldn’t get it OUT of power saver mode.
  • Data Sense:  the app would crash and abend when trying to open it.
  • Mail sync:  would only sync manually
  • Alarm:  I missed my usual bus twice this week because my alarm failed & I overslept.

The end solution:  hard reset, but don’t restore from a backup…  just manually set up your accounts and re-download apps.  It took me a couple hours, but to get my 1520 back on track again, it was well worth the time.  In retrospect, I’m also happier because I didn’t re-install a ton of apps that I don’t use anymore, so the device is much leaner.  

The Windows Phone platform is relatively mature… it doesn’t fail often, but I think I’m going to have to pick up a better SD card.  The hard part is that I think I’ve heard rumors of some of these symptoms on devices that don’t have SD card slots.

My understanding is that it has something to do with the Cyan firmware update.  The Denim firmware may provide more stability, and that update started rolling out to devices in December with a promise that by the end of that month, it would be rolled out to the full Lumia nation.  We’re pushing into Feb 2015, and most in the US are still waiting.

[Addendum, 5/7/2015]:  My Lumia 1520 had a relapse of the above symptoms on Windows Phone 8.1.1 / Denim.   On a whim, I decided to try upgrading to the Windows 10 Insider Preview.  The problems with the SD card intensified as well.  I finally bit the bullet and replaced the SD card.  I did have to hard reset the phone back to the “stock” Windows 10 Insider Preview, but after that, not only were all the above symptoms resolved, but another long running annoyance…  a problem I thought to be related to the Lumia 1520 itself, went away.  The problem…  often, entering the unlock code, number presses would repeat so quickly that the phone would fail to unlock.  Occasionally it was bad enough to lock my phone for a minute or two.    Again, this issue is now resolved along with the other symptoms I noted in this post by replacing the SD card with a new one.

Tech in the 603, The Granite State Hacker

AppStudio gotcha

Recently, I upgraded the Granite State (NH) SharePoint Users Group’s website from WSS 3 (MOSS 2007 generation) to SharePoint Foundation 2013.  The upgrade itself went as well as a 2007 to 2010 to 2013 upgrade could go, in general.

The only real “problem” I ran into was the Windows Phone app I wrote for the group years ago.  It was coming up with a 401 error trying to grab content from lists.asmx.  

I spent some time digging in the dirt, trying to resolve the 401, and hit a few common settings known to have an impact, but no good.  

Rather than struggle with it in my not so copious amounts of spare time, I decided to trash the old app, and build a new one with AppStudio.  

The app loads content from the #NHSPUG web site (, mostly via RSS feeds.  I put a little extra effort into this.  Using AppStudio (, I found a couple hours…  after that, I had not only a much prettier v3 of the Windows Phone app, but a Windows 8.1 (tablet style) publishing package as well.

One thing that caught me off guard though… the Gotcha:

The Windows 8.1 edition of the app wouldn’t load the content from the users group website. 

With some debugging, I found that attempts to load the content were coming up with “Unable to connect to the remote server. hresult=   -2146233088”.

Turns out the error had to do with the fact that I had not enabled Capability “Private Networks (Client & Server” in the Package.appxmanifest.   Ironically, the app works fine anywhere except where I was trying to test it:  on the same network as the content source server. So, to be fair, this is an environmental/configuration issue, not AppStudio, but it was worth mentioning, since my original assumption led me down that path. Maybe this will help someone else.

Oh… Here’s the Windows Phone app:

And here’s the Windows 8.1 (tablet style) app:

And here’s my moment of shame recording the incident and solution in the forums:

Tech in the 603, The Granite State Hacker

Cobbler’s Shoes

Happy New Year! I hope you enjoyed the holidays!
I took time off for the holidays… not as much as I’d have liked to, but enough to enjoy it.

What’d I do?

The cobbler finally got a chance to tend to his own shoes, at least infrastructure wise.

A few years ago, I caught that MS was giving away a license to Windows System Center Core, and I realized I had enough retired hardware to cobble together a hobby-level host. I then did a Physical->Virtual on my small network of Windows 2003 based servers that I ran the NHSPUG website from.

The setup was nice, actually… all three virtual machines ran with room to spare on what was originally an old client-class PC. With dynamic RAM turned on and all three VMs cranking, they occasionally managed to consume nearly a third of the host’s 8GB of RAM.

Having recently had opportunity to get a hold of platform MSDN licensing, I upgraded my entire home network infrastructure by two platform generations across the board.

Seriously… Windows Server 2003 ->  2012 R2 64, SQL 2005 -> 2014, SharePoint WSS3 -> SharePoint Foundation 2013.

Almost all of it was build, replace, rip… build new VMs, integrate them into the domain, migrate data & config as needed, then shut down the systems they replace. The fun one was SharePoint WSS 3.0 upgrading to Foundation 2013. I had to bounce the content databases off a spare 2010 farm I had left over from a project at work. It was nice that it was possible to do that, given that the 2010 farm was a different domain. It’s amazing how much you can get done in short order when you are a one-man IT shop… the communications overhead savings alone is unreal.

The hard part is that newer software in the 64bit range uses much more system resources, so I have extended hosting not just to my System Center, but also to two Windows 8.1 Pro systems running Hyper-V, just to spread out the necessary load and provide some critical system redundancy.

With that, only obvious thing externally is that the Granite State NH SharePoint Users Group website ( ) is now SharePoint 2013 based.

Internally, things generally seem a touch faster, smoother… maybe that’s just psychological, but I notice the difference, even if my wife & kids think it just functions as always, as expected.

I guess the irony in this is that my hobby infrastructure backlog is knocked down a few more notches than I thought I would ever get to… (yes, I took time off from work, and, to chill, I did some of what I do at work.) now my hobby development backlog has new possibilities and subsequently grown substantially.

One of the first things I’ve got to take care of is the few services the SharePoint upgrade has caused… the NHSPUG site still has some cosmetic issues I want to sort out. My Windows Phone apps that integrated with the WSS3 site are now broken, and I have some jiggering to do with my dev environment before I can even diagnose them. That doesn’t even cover some of the things I want to do with the NHWPAD group and my hobby/portfolio projects (e.g. Jimmy Sudoku).

Tech in the 603, The Granite State Hacker

Getting Display Names from User Names in a hostile SharePoint environment

I recently ran into a nasty situation where I needed a reliable way to get a list of user Full Names (or Display Names) from a list of usernames in a SharePoint process.

The short answer was easy…  The code runs server side so…

SPUser theUser = web.EnsureUser(username);
string DisplayName = theUser.Name;


Well, under normal circumstances, sure.  

In this circumstance, I was checking a list of lists of user names, a condition where I might need to check hundreds of items, each of which could have a list of users to check.

No biggie, just add a lookup table and cache the results over multiple calls so that I only ever have to look a user up once in my process.

Now here’s the real kicker.  In my target environment, EnsureUser comes back instantly if the username is a valid, active user in Active Directory.  If the user is not a valid user?   The command takes over 40 seconds per call to fail!

My solution was two-fold.  

1)  use the aforementioned cache strategy, which I have in my sample code below as _nameMap.
2)  Use a simple worker thread.  Give it two seconds to succeed.  Kill the thread if it takes longer than that for any reason.

I initially made the mistake of using SPContext.Current.Web in the thread, but that can *sometimes* produce a threading violation.   The code below creates a whole new instance of SPSite/SPWeb on every pass, but that’s a lot safer and better performing than a lot of alternatives.

private Dictionary _nameMap = new Dictionary();  

private string GetUsersWithTempCacheAndTimeoutEnforcement(string rawUsers)
string result = string.Empty;
SPContext.Current.Web.AllowUnsafeUpdates = true;
foreach (string aUser in rawUsers.Split(';'))
string addUser = string.Empty;
string checkUser = aUser.Split('#')[1];
if (checkUser.Contains("\\"))
lock (_nameMap)
if (_nameMap.ContainsKey(checkUser))
addUser = _nameMap[checkUser] + "; ";
SPUser userResult = null;
SPContext context = SPContext.Current;
string webUrl = context.Web.Url;

System.Threading.ThreadStart st = new System.Threading.ThreadStart(
() =>
using (SPSite site = new SPSite(webUrl))
using (SPWeb web = site.OpenWeb())
userResult = web.EnsureUser(checkUser);
catch (Exception)
{ }
System.Threading.Thread workThread = new System.Threading.Thread(st);
if (workThread.IsAlive)

if (userResult == null)
_nameMap[checkUser] = checkUser;
addUser = checkUser + "; ";
_nameMap[checkUser] = userResult.Name;
addUser = userResult.Name + "; ";
result += addUser;
catch (IndexOutOfRangeException)
catch (Exception ex)
return result;