August 2009 - Posts

Name variable meaningfully all the times

I'm rushing for a SharePoint POC before my vacation next week, and what I have to do is a standard scenario by creating a grid listing items from a custom list, then users click on the first column and redirected to an edit form. I wanted to complete this task as soon as possible but turn out I spend more time than usual.

No item exists at http://SERVER/SITE/mypage.aspx?ID=1. It may have been deleted or renamed by another user.

OK, I admit that I don't want to work this weekend, and I google that there's a well explained article on the support site and importantly -> Always name your variable or method a meaningful name not only (in addition to readibility and supportability reasons. :)

Posted by Colt | with no comments
Filed under:

Four handy utilities in my day job

Just want to highlight four very useful utilites that I use everyday and one important advantage is that all of the tools are very small, handy and able to store and run in my thumb drive.

  1. FastStone Capture - Capture screen shot and video easily (good for documentation and webcast)
  2. ZoomIt - Zoom in / out and highlight anything on screen (good for presentation and meeting)
  3. BgInfo - Display computer information on background (good for demo and development in virtual machine)
  4. VNC Viewer - Remote control computer, even behind firewall (good for remote assistance and support)

Regards,
Colt

Posted by Colt | 1 comment(s)
Filed under:

Best Practices Webcast by INETA APAC

INETA APAC had conducted two webcasts in the last two months, the topics are:

  1. Presenting at large events such as TechEd (by Greg Low)
  2. Sustainability and Green IT Overview (by Alan Dayeh)

 The first webcast is all about presentation skill and common tips & tricks when delivering a large event/conference. It have lots of great tips by an experienced TechEd presenter - Greg. The second one cover the overview of the hottest topic - Green IT and Alan share some information about corporate responsbility and sustainability issues. Both are very informative and relevant to our daily operation and life. You can download and view the recorded sessions at the links above, and may I suggest you to bookmark this link so as to keep track of our series of Best Practice webcasts organized by INETA APAC?

FYI, INETA APAC will have a series of Best Practice webcast scheduled and the next topic will be: Green IT and Client Computing (Wednesday 19th August or Friday 21st August, 5-6pm Sydney time tentatively).

BTW, you can subscribe to our INETA APAC blog or join our group on Facebook and stay connected:

Regards,
Colt

Posted by Colt | 1 comment(s)
Filed under:

PowerShell Script with ASP.NET and Console Application

I have two projects that need to incorporate Windows PowerShell, Exchange Management Shell and ActiveRoles Management Shell for AD (by Quest) in a ASP.NET and a Console Application recently, so I started to look for information about PowerShell scripting with .NET and below are two important articles in my opinion:

  1. HOWTO: Using PowerShell in ASP.NET (.NET Framework 2.0)

The first article explains the most challenging issues in hosting PowerShell scripting with ASP.NET - Security context and permission and describe three common optioins. The second article describes the logic and tips in writing PowerShell in .NET managed code application.

I wrote a small class to execute the PowerShell script, by passing in various script text on the fly. Below is a small code snippet:

  private const string PS_SNAP_IN_MICROSOFT = "Microsoft.Exchange.Management.PowerShell.Admin";
  private const string PS_SNAP_IN_QUEST = "Quest.ActiveRoles.AdManagement";

            RunspaceConfiguration rsConfig = RunspaceConfiguration.Create();
            PSSnapInException snapInException = null;
            rsConfig.AddPSSnapIn(PS_SNAP_IN_MICROSOFT, out snapInException); // Add Exchange Mgmt SnapIn
            rsConfig.AddPSSnapIn(PS_SNAP_IN_QUEST, out snapInException);  // Add Quest Mgmt SnapIn
           
            Runspace myRunspace = RunspaceFactory.CreateRunspace(rsConfig);
            myRunspace.Open();

            Pipeline pipeLine = myRunspace.CreatePipeline();
            pipeLine.Commands.AddScript(scriptText);  // Pass in the script text on the fly
            pipeLine.Commands.Add("Out-String"); 

            Collection<PSObject> cmdResults = pipeLine.Invoke();

            myRunspace.Close();

After preparing these PowerShell scripting in .NET app, I'd suggest to stick with PowerShell because it's handy and flexible. I'd prefer it over DirectoryServices or CDOEXM commands. :) Read the useful articles mentioned above in sequence then you are ready to start coding!

Regards,
Colt

Posted by Colt | 18 comment(s)
Filed under: ,

Data Refresh Failed in Excel Services

I prepared a SharePoint Report Center portal by using SharePoint 2007 recently, but I was unable to refresh the Excel workbook on my portal and got an error message:

Unable to retrieve external data for the following connections:

Connection_Name

The data sources may be unreachable, may not be responding, or may have denied you access. Verify that data refresh is enabled for the trusted file location and that the workbook data authentication is correctly set.

I'm sure my data connection and document library are trusted and I can view the workbook without problem. Here is my detailed situation:

  • Enable Excel services and workbook refresh functionality
  • Upload an Excel workbook to a document library
  • Add a Excel services webpart and point to the newly uploaded workbook
  • Excel workbook render correctly
  • BUT, an error occur if I click "Refresh" button on the top menu

Thanks to my friend Qifeng, he told me that it's related to security restriction and execute three commands. Finally it works:

  1. stsadm -o set-ecssecurity -accessmodel delegation -ssp sspname
  2. stsadm -o execadmsvcjobs
  3. iisreset
Posted by Colt | 2 comment(s)
Filed under:
More Posts