Saturday, February 18, 2012

Installing Windows 8 Developer Preview

Hi all,

I was quite interested in the key note by Steven Sinofsky ( President, Windows and Windows Live Division @ Microsoft) on Channel 9 MSDN Event, and event was pretty long (2 hours 30 minutes). I watched the event by fast forwarding. I wanted to install Windows 8 developer preview and searched over the Internet some blogs have already gave steps to install it.

However when I used VMware player (version 4.0.2, free) and read the blogs (windows7hacker and eightforums) I faced a few issues. The Eight forum looked promising but they require Window 7 Professional or higher for VMware player. However, my PC is Windows 7 home premium 64bit. So, I looked for other options. Another blog (afterdawn) mentioned that they used VMware Workstation (paid) and installed Windows 8 Developer Preview. I downloaded a trail version that lasts for 30 days. When I installed VMware Workstation, it prompted to remove any VMware versions. I removed VMware player and reboot my PC.

These are the steps are from afterdawn and my screenshots are in full screen:

Step1: Get the trail version of VMware workstation here.  You need to register on the VMware site.

Step2: Download Windows 8 Developer Preview. Please note this preview is pre-beta of Windows 8.
I downloaded Windows 8 Developer Preview with developer tools English, 64-bit (x64) version and it comes with (in the aforementioned link above):
  • 64-bit Windows 8 Developer Preview
  • Windows SDK for Metro style apps
  • Microsoft Visual Studio 11 Express for Windows 8 Developer Preview
  • Microsoft Expression Blend 5 Developer Preview
  • 28 Metro style apps including the BUILD Conference app
Step3: Creating new virtual machine in VMware workstation and choose Typical type of configuration and click on Next button


Chose  "I will install the operating system later" and click on the Next button. 


 In the "Select a Guest Operating System" chose "Microsoft Windows" and version selected Windows 7 x64

We name of the Virtual Name. I named VM to "Windows 8 Developer Preview" and changed the location.

 
VMware wizard prompted to "Specify Disk Capacity". I configured to 60 GB and selected "Store virtual disk as a single file"


Next we have to customize the hardware. I chose my settings below and for connection section I selected the ISO file.  

Now, we are done with set up of VMware workstation. I clicked om "Power on this virtual machine"



Step4: 
The "Windows Developer Preview" kicks in  





 Window 8 asked for the language to be installed, time, currency and keyboard. I kept it default settings and clicked on the "Next" button. 
  We click on "Install now" button to install the Windows 8 developer preview


Check the "I accept the license terms"


We will then choose "Custom" for the type of installation 

 We have only one option:


The Window 8 installation starts (it may take 10-15 minutes):

   The next screen asks for the license terms and check "I accept the license terms for using Windows on this PC"
We provide the PC name: 

"Settings" screen give option to choose either "Use express settings" or "Customize". I chose the first option. 


Next screen ask for "Log on". I type in my Hotmail email address and click the "Next" button. 

Entered my Microsoft account password: 

Entered security verification info

 Windows 8 starts and prepare my PC: 


 and new Windows 8 brand UI came to my screen: 

The new Window 8 UI has "App Store", Twitter, Stocks, weather, RSS feed widgets etc out of the box. 

 I need to Install VMware Tools: 


VMware Tools installation kicks in: 



It took time for me as new UI its quite new. My Computer comes with a ribbon. 

  
 Windows 8 comes with Visual Studio 11 express, Expression Blend 5


I took the screen shot key note Steven Sinofsky's event. Currently Microsoft has launched Windows 8 developer preview which is pre-beta. Later they will release Beta, RC, RTM and finally GA (General availability)
 

My take on Windows 8: 
  • The Windows 8 UI is pretty impressive. 
  • It may take time for the customers/users get used with new user interface. 
  • Window 8 PC looks like Windows Phone 7 with tiles. Microsoft call it Metro style and its customizable. Thus, it may take time for users with new style. 
  • In previous blog post (SharePoint vNext) , Microsoft wants to unify all its products (Office 15, SharePoint 2012/13 etc) to have similar look and feel. 
Cheers,
Aroh Shukla

References:
MSDN Windows 8 
A deep dive into Windows 8 Developer Preview
Install Windows 8 Dev Preview in VMware Workstation

Sunday, February 12, 2012

How to: Display SharePoint 2010 groups and users in a web part

Hi all,

Working with Visual Studio 2010 and SharePoint 2010 programming is indeed fun. As we know that Visual Studio 2010 is first class tool for developing SharePoint project templates. In my previous blog post Display SharePoint groups and users in a custom application page. I tried same project (SharePoint 2007) to SharePoint 2010 but faced some issue with SP 2010 and VS 2010.

In my previous blog entry I used (SharePoint 2007): 
  • Publishing features 
  • Custom Application page
  • A user control and application page will host this user control. 
I followed the same steps but I ran into errors.

Firstly, I tried to create a custom application page (which I created in my previous post ) but it gave following Error:
The dynamicmasterpagefile attribute on the page directive is not allowed in this page.

Thus, I found some solutions over the Internet and discovered an interesting written by Geoff Webber  and I created MasterPage in SharePoint and tried to deployed my custom application page but it failed with exactly same error mentioned above.    

Then I tried remove "autoeventwireup" attribute but yet again I got another error: 
The attribute "autoeventwireup" is not allowed in this page.

  I dug into MSDN documentation and found an article from Kirk Evans titled Creating a SharePoint Site Page With Code-Behind Using Visual Studio 2010 I tried using his code. However, he explained more into Site Pages and modifying web.config by using SPWebConfigModification class and I was not convinced because he used site pages and modified web.config and I knew that there should be easier option. Thus, I used to own way and used developed a visual web part and did not use publishing features. There is the walk through: 

Step1: 
Created a new Visual Studio 2010 project >> SharePoint 2010 (Visual C#) template >> chose "Empty SharePoint Project" >> Name: SP2010DisplayGroupsUsers.         

Step2:
The wizard prompts to specify the site  and security level for debugging


Step3: 
Right click on the project >> Add >> New Item >> choose "Visual Web Part" and name it "ShowsGroupsUsers"

Visual Studio 2010 creates a new visual web part associated with a feature. We have to rename the feature so that its more meaningful.


Step 4: 
We drag the TreeView ASP.NET control onto our visual web part, use smart tag to use "Contacts" (AutoFormat) and set appropriate properties such as widh and ID of the tree view control.


Step5: 
Whenever we develop a custom solution such as web part, list with content type or workflow, its best practice also remove via an event receiver so that unnecessary artifacts are removed from the SharePoint server. I have seen people using custom solution but during the deactivation of the feature, the SharePoint root (14 hive) still exists. Thus, we should always clean up the code for deactivation as well.

I am using visual web part and I have to obtain an instance of the "Web Part Gallery". This web part gallery is in fact a list. Therefore, I get used  "GetCatalog" method and supplied WebPartCatalog to get all the web parts that are hosted for the current site collection.   
Then create a SPQuery instance and use CAML query to specific web part which we are creating "ShowsGroupsUsers" as follows:

Event Receiver Feature Activation 


We do the code for feature deactivating and this time we will remove web part item from the site collection. 

Event Receiver Feature Deactivation
 
Step6: 
What I found slightly annoying while developing Visual Studio 2010 SharePoint projects, when we develop a custom solution and tried to deploy to SharePoint, the features are activated automatically. Thus, I created a custom deployment by clicking on the project, right click on the "Properties", going on SharePoint tab, create a "New" deployment configuration and selected only till "Add Solution" and choose "Active Deployment Configuration" our new "Custom Deployment". 

Step7: 
We create images folder for your web part. VS2010 provides "Mapped" folder when we create any new artifact. 

We use 'SharePoint "Images" mapped folder' for our project. It will VS2010 will then create a sperate folder for our project. 
Step8:
We will then deploy our custom solution to SharePoint server using our own "Custom Deployment"

Now, we go to "Site Collection Features" and activate our new web part. 

Again, CKSDev helps to attach all the IIS worker processes (w3p). 

Step8: 
We can test our web part inserting our new web part. 


The web part shows all groups and members for specific site collection.  

We can also check if the web part is there in web part gallery: 


Now, comes an important aspect. If at all business users wants to deactivate this feature. We must remove this web part from this site collection by clicking the "Deactivating" feature. After feature is deactivated we must check if the web part is there in web part gallery. It should not. 


I need to point out few things here:
  1. I have configured Active Directory, add few dummy users and used User Profile Service Application (detailed in my earlier blog: Configure User Profile Service Application in Sharepoint 2010 ) and pulled AD users in SharePoint 2010. So, all the users actually come from Active Directory.      
  2. There are third party components which, I think, does same thing which I have written in this blog entry. One of the products is Qdabra Active Directory Web Service  and product leverages InfoPath to pull the information from AD onto SharePoint. They have dedicated support but the product comes with hefty price.
If you feel that it helped you in anyway, please comment.
Happy programming!

Cheers.
--aaroh

Download the source code here.

How to: Use cascading drop-down lists in PowerApps

Hi all, Using cascading dropdown, users can easily fill the forms by selecting drop-down values dependent on values from another dro...