Virtual Business Card


A Jack of all trades is a master of integration, as such an individual who knows enough from many learned trades and skills to be able to bring their disciplines together in a practical manner, and is not a specialist but can be an expert in many fields. Such a person is known as a polymath or a renaissance man; a typical example is someone like Leonardo da Vinci.

Tuesday, June 26, 2012

Friday, June 22, 2012

Recursively get all users in a group in Active Directory C#



   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.ComponentModel;
   4:  using System.Data;
   5:  using System.Drawing;
   6:  using System.Linq;
   7:  using System.Text;
   8:  using System.Windows.Forms;
   9:  using System;
  10:  using System.DirectoryServices;
  11:  using System.Collections.Generic;
  12:  using System.DirectoryServices.AccountManagement;
  13:   
  14:  namespace RecurseUsersInGroups
  15:  {
  16:      public partial class FormGroups : Form
  17:      {
  18:   
  19:          StringBuilder _builder = new StringBuilder();
  20:   
  21:          public FormGroups()
  22:          {
  23:              InitializeComponent();
  24:          }
  25:   
  26:          private void buttonGetAllUsers_Click(object sender, EventArgs e)
  27:          {
  28:              try
  29:              {
  30:                  textBoxUsers.Clear();
  31:                  _builder.Clear();
  32:   
  33:                  PrincipalContext ctx = new PrincipalContext(ContextType.Domain, textBoxDomain.Text);
  34:                  GroupPrincipal grp = GroupPrincipal.FindByIdentity(ctx, IdentityType.Name, textBoxADGroup.Text);
  35:   
  36:                  if (grp != null)
  37:                  {
  38:                      foreach (Principal p in grp.GetMembers(true))
  39:                      {
  40:   
  41:                          if (!_builder.ToString().Contains(p.SamAccountName))
  42:                          {
  43:                              _builder.Append(p.SamAccountName);
  44:                              _builder.Append("; ");
  45:                          }
  46:                      }
  47:   
  48:                      textBoxUsers.Text = _builder.ToString();
  49:   
  50:                      grp.Dispose();
  51:                      ctx.Dispose();
  52:   
  53:                  }
  54:                  else
  55:                  {
  56:                      MessageBox.Show("\nWe did not find that group in that domain, perhaps the group resides in a different domain?");
  57:                  }
  58:              }
  59:              catch (System.Exception)
  60:              {
  61:   
  62:                  MessageBox.Show("\nWe did not find that group in that domain, perhaps the group resides in a different domain?");
  63:              }
  64:             
  65:   
  66:   
  67:          }
  68:   
  69:   
  70:   
  71:      }
  72:  }

Thursday, June 21, 2012

Anonymous Access, SharePoint not ‘Forcing’ an Automatic Sign In

If for what ever reason (read disclaimer at end) you need anonymous access enabled on a SharePoint site that is using windows authentication, you will notice that even as an authorized user you are not signed in automatically. The anonymous ‘experience’ will always take precedence over the users credentials.


This is the way the HTTP protocol works so IIS and SharePoint are off the hook for this issue.


If you do want to be a recognized user then you will need to click on the ‘Sign In’ link at the top of the site. Depending on your browser security settings you will either be signed in automatically or prompted for credentials.
Solution:

This is less of a solution and more of a work around but it will achieve the desired result. To force an auto-sign in under SharePoint you need a page that has unique permissionsto force the challenge/response for credentials. This can then be provided to the authenticated users as the ‘authenticated’ homepage url.


There are a few limitations with this method:
  • Anonymous users will not be able to access this page
  • To be more useful the page will probably need some redirection, i.e. To pass the user back to a global home page, and this provides its own set of challenges
  • Unless the authenticated user hit this page first, i.e. They follow direct links to somewhere else in the site, they will not be signed in

Friday, June 8, 2012

Error When Creating an Appointment in Nintex Workflow 2010

When you run the workflow, you get the error:




Failed to invoke web service. Error returned from server: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel



To solve the problem:

1.) Add the root certificate of the web service. For more details look at:

http://connect.nintex.com/forums/thread/1433.aspx

2.) Run



foreach ($cert in (Get-ChildItem cert:\LocalMachine\Root)) { if (!$cert.HasPrivateKey) {New-SPTrustedRootAuthority -Name $cert.Thumbprint -Certificate $cert } }



For more details: http://connect.nintex.com/forums/post/19080.aspx



Tuesday, June 5, 2012

Detail Tool Tip for Room Manager Calendar for SharePoint 2010

My developer and I have been working on a custom tool tip for a calendar for Room Manager which is a third party Room Booking Solution for SharePoint 2010.  What the tooltip does, is it does an ajax call to the details page of the room booking and display it in a tool tip.  We used the sample javascript found in http://sharepointjavascript.wordpress.com/2012/02/12/list-view-preview-item-on-hover-sharepoint-2010/ and tweeked it a bit.  The solution is two part: PreviewItemOnHovertest.js and a content web part on the calendar page.


PreviewItemOnHovertest.js:
https://skydrive.live.com/redir?resid=9F717AF2A2401F0F!5088

 
If you want to customize what fields participates in the hover (e.g. using Sharepoint Calendar WebPart), modify the calAddHover function.

Content Web Part:
https://skydrive.live.com/redir?resid=9F717AF2A2401F0F!5089