Search my blog articles

Sunday, December 07, 2008

Binding Word 2007 Content Control to a custom XML data.

I have out-lined in brief steps how to bind a cusotm xml data to content control in a docx file. This article is not complete. I will update it with code and programatic explanations. 

so far....
Binding Content control to custom XML.
1. Download the following content control Toolkit from Code Plex.
2. Create a new FileSystem based web site on .net 3.5 frameworkon visual studio 2008.
3. For data base access create a new Link to SQL data source. 
4. Copy the Document that we need to merge to the App_data folder.
5. Open the docx file and insert all the content that we would like to bind at runtime. 
a. How to enable the developer tab to add these content controls. 
6. Save the file.
7. Using Visual studio create an xml file with the following Nodes. 


8.Start the Word 2007 Content Control ToolKit, Open the custom document that we created.  We can see the Content Controls present in the documents. Paste it inside the "Edit View" tab of the Custom XML Part section of the app. 

9. Switch to the "Bind View" tab select the individual xml nodes in the Tree view and drag it its corresponding content controls to creat the link between the custom xml nodes to the content control. 

10 Save the docx file. 

to be continued...

Reference links : 

Andrew coates




Friday, November 28, 2008

Im still in the Black on this Friday.

Another Thanks giving has come and gone and to put it simply, it was good. We had a quite dinner with a another family we know for a long time. Since I lost interest in shopping for "Deals" on Friday after thangs giving day, A.K.A "Black Friday", I did not participate in the ever so maddening early morning shopping spree.

Well, the same can not be said about the guy who lost his life in line of duty at a walMart! in Long Island NY. As the below article points out, the guy was just a temporary maintenance worker who was fixing something at the store.

FOXNews.com - Wal-Mart Worker Dies When Shoppers Break Down Doors - Local News News Articles National News US News

I am sure this is not the first time such an incident is happening, but what struck me most was the fact that the guy was 34 years old as old as I am, may be has a family like mine and dream and aspirations like me, heck it could have been me!

I am not mathematician or cost analyst, but if 100 people were able to get in and get the best deals offered by breaking open the door of that WalMart, each might have bought goods worth an avarage of $1000 dollars. On an average they might have saved 20 percent over retail. That amounts average savings of $200 dollars per shopper, which is a total of $20,000 total savings for those people who got in first.

How can those people sleep well at night or gift those things they bought upon the death of a man's life to their loved ones? Why is buying and amassing meterialistic things at such cost is such a grave problem for America, I will try to dig up books on this topic, I am sure there are research papers on issues like this. Whatever might be the underlying reason, a man's life is not worth of any retail store deal.

If we try to extropolate this, next year would be a worse year economically speaking, hence people are gonna want more deals like this, people are gonna get more restless and retailers are gonna give out more "deals" like this to entice more deal seekers. I don't see such mad and senseless incidents being a rare and freak accident, rather a routine BlackFriday deal event.

Well, I do hope the change that is coming is good, I do hope people have more compasion towards fellow humans, I wish these deal seekers try to keep their decency and other people's saftey in mind.

As far as me and shopping, I will stick with sites like www.deals2buy.com , or www.edealinfo.com or www.dealcatcher.com for my deals. Heck! if I can't get it , better yet, I am left with my money and I don't pile up things I don't need. Black anyday for me is better than black friday for the retailers.

I can't wait for Christmas and its share of drama in our annual shopping season, god bless us all.

-Yogesh

Sunday, November 09, 2008

MagicJack - awaiting acknowledgement issue

We switched over to MagicJack 4 months ago and we have been happy with it. Other than the
issue with magicJack not starting up when my server reboots after a MS update.
Well, lately over 3 or 4 weeks my MagicJack has been dropping calls like crazy.
I can receive calls, but right after 30-34 seconds the call will be dropped, as if on a timer.
I noticed when this happens the the softphone dispaly says "Awaiting Acknowledgement", kinda
wierd.

Well, like a good customer I called the Crappy Technical chat support of MagicJack. That was
my first mistake in fixing this issue. After 3 hours of doing mundane things like rebooting
and restarting and upgrading the issue would not go away.

I gave up on the issue until my lovely wife,Sue, said, she will give it a try. Well, with a stupid
grin I said, "I will give you a $100 if you can fix by tonight.". My bet was well backed. I
am the tech geek in thehouse, I hold the engineering degree and I'm the one who works with 4
computers at a time. So at that time the chances of she figuring it out was slim. hmmm.
My wife, Sue, is a problem solver, it has been proven time and again, she is the smarter one
in the family. A fact I am constanty try to overturn. Anyway. She gets on google and finds a
forum which is specific for MagicJack. (its is unofficial, as in, not a MagicJack website)


http://www.magicjacksupport.com/


Well, sue posts a message on it asking users about the dreaded " Awaiting Acknowledgement"
issue. Sure enought, within a few mintues, a good person suggests such an issue being
experienced by other MagicJack users too. They seem to be having this issue when used behind
a Linksis router model number WRT54GL.
I love this router for its features and stability, and it never occured to me that a
standard solid router like wrt54gl would pose such restrictions and problems with VOIP
devices like MagicJack.
Well this issue did not occur for the past 3 months I have been using this router and
magicJack together, this leads me to think , this is because of some changes in the way
MagicJack is routing call lately.


So here are the fact that I was able to establish so far.

1. MagicJack has changed the way it is routing calls or its protocol.
2. Linksys Router WRT54GL might cause an issue with Magic Jack.
3. MagicJack online chat support sucks and is worthless.
4. I can receive calls but the call will be dropped due to "Awaiting Acknowledgement" issue.

Here are the step I took to trouble shoot this issue.To address the first issue, I opened up all ports and firewalls on my computer to enable

unrestricted access. Still no dice. I even opened up the firewalls on the linksys router, to
allow all traffic. Even thought its not adviced I did it to make sure none of the components
are restricting any traffic.

To address the second issue, I bypassed my router for my internet connection and connected
my computer directly to the Motorolo Broadband Modem. I reset my Model and renewed my IP
address on my computer. Now I had a direct Internet connection from my Modem to my computer
without any network deviced inbetween.
I restarted my MagicJack and connected a static phone directly to my magicJack device. Used my cell phone to call my landline and the call went thru. I waited for 34 seconds to pass by and to my amazement. The call did not drop. To take it to the next level and asked my wife to call my home as I was on the line. When the call came in, I clicked on conference option and we were on 3 way conference all at once. The call quality was excellent. Issue 4 was thus solved.
This made it clear that the linksys router WRT54GL was causing some kinda Protocol block which was not allowing Magicjack to complete the call successfully.
Af far as fact 3, MagicJack suckky Online chat support is a waste of time and test in patience.
Now comes the question, should I replace the router or should I fix my router. My wife Sue, points me again to another post in the forum about a guy fixingin his router by applying Tomato firmware for WRT54GL.


I am kinda of conservative on these things, I did not want to change the entire firmware for one issue. But heeder Sue's advice I visited the Tomoto firmware's website. http://www.polarcloud.com/tomato
The download was quick, the stetup instructions were clear. Visit their website for more info.
Within 10 minutes of following simple instructions(no geekly hacking steps), I was able to patch my WRT54GL router with Tomato firmware.


Hooked up my router the Internet Model and hooked up my computer to the router and tested Internet connectivity, every thing was fine.


Restarted Magic Jack and made a test call to my home number. The call went thru and everything was working as expected. Issue solved.


Here are a few highlights,

1. If you are using MagicJack and you use a router WRT54GL you will have issues.
2. To fix this, either change the router or Flash your router with Tomato Firmware.
3. Don't try to talk to the MagicJack online Chat Support, visit, http://www.magicjacksupport.com/

At the end of the day, I had lost almost 4 hours of my week end and lost a bet with my wife for $100.


Happy calling. -Yogesh

Sunday, October 26, 2008

Here are the 9 Things I Should Do Instead of Buying Stocks

I got this page from the dilbert.com blog. I plan to do this pretty soon. Sadly I have only 2 thing done, ie.,

Pay off my CCs
Buy a House.

Hope fully god willing I should be done with this by the end of next month.


9 Things You Should Do Instead of Buying Stocks:

"Make a will.
Pay off your credit cards.
Get term life insurance if you have a family to support.
Fund your 401(k) to the maximum.
Fund your IRA to the maximum.
Buy a house if you want to live in a house and can afford it.
Put six months' worth of expenses in a money market account.
Take whatever money is left over and invest 70% in a stock index fund and 30% in a bond fund through any discount broker, and never touch it until retirement.
If any of this confuses you, or if you have something special going on (retirement, college planning, tax issues), hire a fee-based financial planner."

Wednesday, October 15, 2008

DNS error while Activating Windows server 2008

I have installed 3 windows 2008 server so far, 2 on Virtual servers images. I have faced one constant issue with all 3 server,

If you get an error saying

A problem occurred when Windows tried to activate.
Error Code 0x8007232B.

Follow these steps to resolve it.
Open Control Panel
Open "System"
In the "Windows Activation" section
Click on "Change product key" link.
Enter your old product key you used during the installation.
(You can get this once you login to MSDN subscriber website. )
Once you enter the old product key, windows should automatically try to activate your Windows server and Activate successfully.

Hope these steps solves your activation issue.
-Yogesh

Saturday, October 11, 2008

New Build of Silverlight Client library for Data Services!

If you are using Data Services with Siverlight data Services client object you would have come across this error.
"The closed type System.String does not have a corresponding Category settable property"

"I was able to download the fix for this issue, here is the link I used,
http://www.microsoft.com/downloads/details.aspx?FamilyId=CF8F88C3-D869-46DE-A7BF-FB7712C791B7&displaylang=en"

This is a temporary fix until they come out with the next release.

You need to copy the included System.Data.Services.Client.dll file into the
\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client folder.

Wednesday, September 24, 2008

My latest Project

I am trying to develop a simple Indian recipe website with some pizzaz to it using Silverlight 2.0 and WCF(hidden pizzaz) on a .NET 3.5 framework and VS 2008.

The main goal of this effort is to Learn the new technologies, document my process as I develop it and finally provide the entire source and data for the website as a download to whoever wants it.

Simple as Pi!


The diagram above the basic structure of the web application.



Here is the MSDN Magazine link that I am using as my guiding demo project. I'll plan to do something similar like this.
Data Points: Service-Driven Apps With Silverlight 2 And WCF

Plz stop by again for a multipart article detailing the construction and demos.

Sunday, September 07, 2008

How to Add Social Bookmarking Sharing Button to your blog

You may call me a novice/fresh meat or FOB when it comes to blogging, though I have been blogging for a few years, not so prolificaly but on and off, I had yet to find a simple widget when it comes to adding a "share this" button.

These are simple buttons that when clicked on by viewers of your blog enables them to add a link of your blog to their favorite Social Bookmarking site. This also give me some kind of stats to track back( another facy blogging term I leared recently) my blog entires and see what people liked and shared with others.

Well, I "stumbled upon" this website call Addthis, this is so sweet gives you a simple code to add to your blog summary and voila! you have social sharing enabled to your Blog, whatever be your blogging medium.

Check them out, I like it, purely for their simplicity and ease of setup.

Link to AddThis.com
AddThis - #1 Social Bookmarking Sharing Button - Del.icio.us Digg Facebook Widget

Saturday, August 23, 2008

Virtual server 2005 on Windows 2008 Host - My experience and article I refered to

My current project is to install MOSS 2007 in a virtual setup. I wanted to install a DC on a virtual server and MOSS on a virtual server using the new virutal DC. I want the DC to be isolated and just used by server and services of MOSS 2007.




My first question was this,


"Can I install Virtual Server 2005 on my new Windows server 2008 standard Edition?"


The answer to that is YES. To answer my initial question, here are some of the blogs and article I got from my brother Google.

The article listed below by WSV_GUY(Jeff) from the Technet Blogs is this, great article which talks about how to setup your host server IIS to enable faultless VS 2005 r2 SP1 deployment.

Windows Virtualization Team Blog : Installing Virtual Server R2 SP1 on Windows Server 2008 Beta 3


Another great Article I found was from Gary Olsen's article talks about how to setup a testing lab on Virtual server setup. Gary gives some sound advice and best practices on setting up virutal server and reusing them for other servers.




Then the second qustion was "Where the heck can I get this Virtual Server 2005 R2 SP1 from?" I was able to down load the Virtual Server 2005 R2 SP1 Enterprise Edition (32-bit) from this page


Download Microsoft Virtual Server 2005 R2 SP1: "Virtual Server 2005 R2 SP1 Enterprise Edition (32-bit)"


This asked me to register , I used my old hotmail ID to login after which I was good to down load. BTW, I was able to download this 40 MB file under 47 seconds, which I thought was an impressive download speed.




Tuesday, August 12, 2008

Joomla! What is it? is it worthwhile?

Recently I've been hearing a lot about an open source content Management system called Joomla!. Though the base technology is not on .NET framework I am very curious to see how system is put together. Stop by in a day or two to read my $0.02 worth of review.

Dev Express is offering 60 Win and Web form controls FREE!

I came across this offer for free controls and me being a nice guy and all I thought I would share it in my blog!

Over 60 Free Controls from DevExpress

Enjoy!

Wednesday, August 06, 2008

Now you too can have a (virutal)Personal assistant.



I know we all want a personal assistant to help us catch up with our day to day tasks and such, the stopping factor had been cost of hiring one, now with this Offshore company in India providing Virtual Personal assitants we all can have our very own personal assistants :) Here is the link to that company in India.

Tasks EveryDay: 24 / 7 Business & Personal Virtual Assistant India.

Wonder what else can I offshore?

Monday, August 04, 2008

Creating System Ino using BGInfo.

I have always wanted a simple app to create background with some of the system info for my servers at home, so that when I give access to people, some of the obvious info like the Domain Name, SQL instance name, IP, OS version will be visible right on the Desktop as desktop background.

Until recently, I was creating bitmaps using MSPaint and using that as thebackground then I found this simple app called BGInfo, its from www.sysinternals.com very handy,

Saturday, August 02, 2008

Upgrading WRT54GL to DD-WRT v24 sp1

Hi all, In a few minutes I will attemp to upgrade my brand new WRT54GL's frimware to DD-WRT v24 sp1. I am not sure how this will turn out. This is the first time I am trying to do anything with a firmware of any device. I was able to find numerous articles on how to do this, including this one from M & L Adventures. (How to Flash the WRT54GL with DD-WRT Firmware at M and L Adventures). I will update with pictues on how my upgrade went.

Monday, June 23, 2008

Notification Services Error with vista

Here is the Error I found while trying to setup one of the Notification Setup Samples,

I was trying to unregister a Notification Service.


The Service Control Manager could not be opened to configure the Notification Services process.Win32 Error Code: 5Win32 Error Text: Access is denied.
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=NSEventStrings&EvtID=OpenServiceControlManagerFailed&LinkId=20476


Very cryptic, yet very basic error. As the error says, I don;t have access, but to what do I don't have access to is the question?

I was able to fix it by launching the MSSQL management studio as an administrator by right clicking on the Start menu link and choosing "Run as Administrator" option.

Apparently when started SQL Management Studio, I don't run it as an administrator. I changed the secruity context of the shortcut to run as an administrator.

I am not sure of the complete implications of running my management studio as an admin, but it helps in resolving the issue.

-Y

Friday, June 13, 2008

Free software to College Kids

I came across this article on Microsoft on Free Profession grade software to all(ALL) college students, you have to provide your student ID and your passcode and MS will verify with its college network and then the software is ready to download.

I think this is a very good idea, exposing professional software to Students and at the same time, establishing their future developer base.

Here is the Link : Microsft DreamSpark

Thursday, May 01, 2008

Share point Interview Questions

1) What are the two base classes a WebPart you are going to use within SharePoint 2007 can inherit from?

There are two base classes that a WebPart which is going to be consumed by SharePoint can inherit from, either the SharePoint WebPart Base class or the ASP.NET 2.0 WebPart base class. When inheriting from the SharePoint WebPart Base class your derived WebPart class will inherit from Microsoft.SharePoint.WebPartPages.WebPart. When inheriting from the ASP.NET 2.0 WebPart base class your derived WebPart class will inherit from System.Web.UI.WebControls.WebParts.WebPart. It is considered good practice to use the ASP.NET WebPart base class since the old base class is meant for backwards compatibility with previous version of SharePoint, however there are four exception when it is better to leverage functionality from the SharePoint WebPart base class:

Cross page connections

Connections between Web Parts that are outside of a Web Part zone

Client-side connections (Web Part Page Services Component)

Data caching infrastructure

2) What are the differences between the two base classes and what are the inherit benefits of using one over another?

The difference is the Microsoft.SharePoint.WebPartPages.WebPart base class is meant for backward compatibility with previous versions of SharePoint. The benefit of using the SharePoint WebPart base class is it supported:

Cross page connections

Connections between Web Parts that are outside of a Web Part zone

Client-side connections (Web Part Page Services Component)

Data caching infrastructure

ASP.NET 2.0 WebParts are generally considered better to use because SharePoint is built upon the ASP.NET 2.0 web architecture. Inheriting from the ASP.NET 2.0 base class offers you features that inherit to ASP.NET 2.0, such as embedding resources as opposed to use ClassResources for deployment of said types.

3) What is the GAC?

The GAC stands for the global assembly cache. It is the machine wide code cache which will give custom binaries place into the full trust code group for SharePoint. Certain SharePoint assets, such as Feature Receivers need full trust to run correctly, and therefore are put into the GAC. You should always try to avoid deployment to the GAC as much as possible since it will possibly allow development code to do more than it was intended to do.

4) What is strong naming (signing) a WebPart assembly file mean?

Signing an assembly with a strong name (a.k.a strong naming) uses a cryptographic key pair that gives a unique identity to a component that is being built. This identity can then be referred throughout the rest of the environment. In order to install assemblies into the GAC, they must be strongly named. After signing, the binary will have a public key token identifier which can be use to register the component in various other places on the server.

5) What are safe controls, and what type of information, is placed in that element in a SharePoint web.config file?

When you deploy a WebPart to SharePoint, you must first make it as a safe control to use within SharePoint in the web.config file. Entries made in the safe controls element of SharePoint are encountered by the SharePointHandler object and will be loaded in the SharePoint environment properly, those not will not be loaded and will throw an error.

In the generic safe control entry (this is general, there could be more), there is generally the Assembly name, the namespace, the public key token numeric, the typename, and the safe declaration (whether it is safe or not). There are other optional elements.

6) What is the CreateChildControls() method? How can you use it to do something simple like displaying a Label control?

The CreateChildControls method in WebParts is used to notify the WebPart that there are children controls that should be output for rendering. Basically, it will add any child ASP.NET controls that are called instantiating each control with its relevant properties set, wire any relevant event handlers to the control, etc. Then the add method of the control class will add the control to the controls collection. In the relevant WebPart render method, the EnsureChildControls method can be called (or set to false if no child controls should be called) to ensure that the CreateChildControls method is run. When using CreateChildControls it implies that your WebPart contains a composition of child controls.

In order to create something like a label control in Create, you would create a new label control using the new keyword, set the various properties of the control like Visible=True and ForeColor = Color.Red, and then use Controls.Add(myLabelControl) to add the control to the controls collection. Then you can declare EnsureChildControls in the Render method of the WebPart.

7) What does the RenderContents method do in an ASP.NET 2.0 WebPart?

The render contents method will render the WebPart content to the writer, usually an HtmlTextWriter since WebParts will output to an HTML stream. RenderContents is used to tell how the controls that are going to be displayed in the WebPart should be rendered on the page.

*** Side Question: I got asked what the difference between CreateChildControls and the RenderContents method. The CreateChildControls method is used to add controls to the WebPart, and the RenderContents method is used to tell the page framework how to render the control into HTML to display on a page.

8) What is the WebPartManager sealed class? What is its purpose?

The WebPartManager sealed class is responsible for managing everything occurring on a WebPart page, such as the WebParts (controls), events, and misc. functionality that will occur in WebPartZones. For example, the WebPartManager is responsible for the functionality that is provided when you are working with moving a WebPart from WebPartZone to WebPartZone. It is known as the “the central class of the Web Part Control Set.”

*** Side Question: I got asked how many WebPartManager controls should be on a page. In order to have WebParts on a page there has to be just one WebPartManager control to manage all the WebParts on the page.

9) What is a SPSite and SPWeb object, and what is the difference between each of the objects?

The SPSite object represents a collection of sites (site collection [a top level sites and all its subsites]). The SPWeb object represents an instance SharePoint Web, and SPWeb object contains things like the actual content. A SPSite object contains the various subsites and the information regarding them.

10) How would you go about getting a reference to a site?

C#:
  1. oSPSite = new SPSite("http:/server");
  2. oSPWeb = oSPSite.OpenWeb();

11) What does a SPWebApplication object represent?

The SPWebApplication objects represents a SharePoint Web Application, which essentially is an IIS virtual server. Using the class you can instigate high level operations, such as getting all the features of an entire Web Application instance, or doing high level creation operations like creating new Web Applications through code.

12) Would you use SPWebApplication to get information like the SMTP address of the SharePoint site?

Yes, since this is a Web Application level setting. You would iterate through each SPWebApplication in the SPWebApplication collection, and then use the appropriate property calls (OutboundMailServiceInstance) in order to return settings regarding the mail service such as the SMTP address.

Side Question: I got asked if there are other ways to send emails from SharePoint. The answer is yes, there is. You can use the SendMail method from the SPutility class to send simple emails, however it is not as robust as using the System.Net.Mail functionality since it doesn’t allow things like setting priorities on the email.

13) How do you connect (reference) to a SharePoint list, and how do you insert a new List Item?

C#:
  1. using(SPSite mySite = new SPSite("yourserver"))
  2. {
  3. using(SPWeb myWeb = mySite.OpenWeb())
  4. {
  5. SPList interviewList = myWeb.Lists["listtoinsert"];
  6. SPListItem newItem = interviewList.Items.Add();
  7. newItem["interview"] = "interview";
  8. newItem.Update();
  9. }
  10. }

14) How would you loop using SPList through all SharePont List items, assuming you know the name (in a string value) of the list you want to iterate through, and already have all the site code written?

C#:
  1. SPList interviewList = myWeb.Lists["listtoiterate"];
  2. foreach (SPListItem interview in interviewList)
  3. {
  4. // Do Something
  5. }

15) How do you return SharePoint List items using SharePoint web services?

In order to retrieve list items from a SharePoint list through Web Services, you should use the lists.asmx web service by establishing a web reference in Visual Studio. The lists.asmx exposes the GetListItems method, which will allow the return of the full content of the list in an XML node. It will take parameters like the GUID of the name of the list you are querying against, the GUID of the view you are going to query, etc.

Side Question: I got asked how I built queries with the lists.asmx web service. In order to build queries with this service, one of the parameters that the GetListItems method exposes is the option to build a CAML query. There are other ways to do this as well, but that was how I answered it.

16) When retrieving List items using SharePoint Web Services, how do you specify explicit credentials to be passed to access the list items?

In order to specify explicit credentials with a Web Service, you generally instantiate the web service, and then using the credentials properties of the Web Service object you use the System.Net.NetworkCredential class to specify the username, password, and domain that you wish to pass when making the web service call and operations.

*** Side Question: I got asked when you should state the credentials in code. You must state the credentials you are going to pass to the web service before you call any of the methods of the web service, otherwise the call will fail.

17) What is CAML, and why would you use it?

CAML stands for Collaborative Application Markup Language. CAML is an XML based language which provides data constructs that build up the SharePoint fields, view, and is used for table definition during site provisioning. CAML is responsible for rending data and the resulting HTML that is output to the user in SharePoint. CAML can be used for a variety of circumstances, overall is used to query, build and customize SharePoint based sites. A general use would be building a CAML query in a SharePoint WebPart in order to retrieve values from a SharePoint list.
18) What is impersonation, and when would you use impersonation?

Impersonation can basically provide the functionality of executing something in the context of a different identity, for example assigning an account to users with anonymous access. You would use impersonation in order to access resources on behalf of the user with a different account, that normally, that wouldn’t be able to access or execute something.

19) What is the IDesignTimeHtmlProvider interface, and when can you use it in WebParts?

The IDesignTimeHtmlProvider interface uses the function GetDesignTimeHtml() which can contain your relevant render methods. It was helpful to use in 2003 since it allowed your WebPart to have a preview while a page was edited in FrontPage with the Webpart on it, because the GetDesignTimeHtml() method contains the HTML for the designer to render.

20) What are WebPart properties, and what are some of the attributes you see when declaring WebPart properties in code?

WebPart properties are just like ASP.NET control properties, they are used to interact with and specify attributes that should be applied to a WebPart by a user. Some of the attributes you see with ASP.NET 2.0 properties are WebDescription, WebDisplayName, Category, Personalizable, and WebBrowsable. Although most of these properties come from the System.Web.UI.WebControls.WebParts class, ones like Category come out of System.ComponentModel namespace.

21) Why are properties important in WebPart development, and how have you exploited them in past development projects? What must each custom property have?

Properties are important because WebParts allow levels of personalization for each user. WebPart properties make it possible for a user to interact, adjust, and increase overall experience value with the programmatic assets that you develop without having the need to use an external editor or right any code. A very simple example of exploiting a property would be something like allowing the user to change the text on the WebPart design interface so that they can display whatever string of text they desire.

Each custom property that you have must have the appropriate get and set accessor methods.

22) What are ClassResources? How do you reference and deploy resources with an ASP.NET 2.0 WebPart?

ClassResources are used when inheriting from the SharePoint.WebPart.WebPartPages.WebPart base class, and are defined in the SharePoint solution file as things that should be stored in the wpresources directory on the server. It is a helpful directory to use in order to deploy custom images. In ASP.NET 2.0, typically things such as images are referenced by embedding them as resources within an assembly. The good part about ClassResources is they can help to eliminate recompiles to change small interface adjustments or alterations to external JavaScript files.

23) What is a SharePoint Solution File? How does it differ from WebPart .cab files in legacy development? What does it contain?

A SharePoint solution file is essentially a .cabinet file with all a developers ustom componets suffixed with a .wsp extension that aids in deployment. The big difference with SharePoint solution files is is that a solution:

allows deployment to all WFE’s in a farm

is highly manageable from the interface allowing deployment, retraction, and versioning

Can package all types of assets like site definitions, feature definitions (and associated components), Webparts, etc.

Can provide Code Access Security provisioning to avoid GAC deployments

Just to name a few things…

24) What is a .ddf file and what does it have to do with SharePoint Solution creation?

A .ddf file is a data directive file and is used when building the SharePoint solution bundle specifying the source files and their destination locations. The important thing for someone to understand is that the .ddf file will be passed as a parameter to the MAKECAB utility to orchestrate construction of the SharePoint solution fiel.

25) What file does a SharePoint solution package use to orchestrate (describe) its packaged contents?

The solution Manifest.XML file.

26) What deployment mechanism can you use to instigate Code Access Security attributes for your WebParts?

SharePoint solution files can add in order to handle code access security deployment issues. This is done in the element in the SharePoint solution manifest.XML, which makes it easier to get assemblies the appropriate permissions in order to operate in the bin directory of the web application.

27) What is a SharePoint Feature? What files are used to define a feature?

A SharePoint Feature is a functional component that can be activated and deactivate at various scopes throughout a SharePoint instances, such as at the farm, site collection, web, etc. Features have their own receiver architecture, which allow you to trap events such as when a feature is installing, uninstalling, activated, or deactivated. They are helpful because they allow ease of upgrades and versioning.

The two files that are used to define a feature are the feature.xml and manifest file. The feature XML file defines the actual feature and will make SharePoint aware of the installed feature. The manifest file contains details about the feature such as functionality.

Side Question: I got asked how the introduction of features has changed the concept of site definitions. SharePoint features are important when understanding the architecture of site definitions, since the ONET.XML file has been vastly truncated since it has several feature stapled on it.

28) What types of SharePoint assets can be deployed with a SharePoint feature?

Features can do a lot. For example, you could deploy

Simple site customizations

Custom site navigation

WebParts

pages

list types

list instances

event handlers

workflows

custom actions

just to name a few….

29) What are event receivers?

Event receivers are classes that inherit from the SpItemEventReciever or SPListEventReciever base class (both of which derive out of the abstract base class SPEventRecieverBase), and provide the option of responding to events as they occur within SharePoint, such as adding an item or deleting an item.

30) When would you use an event receiver?

Since event receivers respond to events, you could use a receiver for something as simple as canceling an action, such as deleting a document library by using the Cancel property. This would essentially prevent users from deleting any documents if you wanted to maintain retention of stored data.

31) What base class do event receivers inherit from?

Event receivers either inherit from the SPListEventReciever base class or the SPItemEventReciever base class, both which derive from the abstract base class SPEventReceiverBase.

32) If I wanted to not allow people to delete documents from a document library, how would I go about it?

You would on the ItemDeleting event set: properties.Cancel= true.

33) What is the difference between an asynchronous and synchronous event receivers?

An asynchronous event occurs after an action has taken place, and a synchronous event occurs before an action has take place. For example, an asynchronous event is ItemAdded, and its sister synchronous event is ItemAdding.

34) How could you append a string to the title of a site when it is provisioned?

In the OnActivated event:

C#:
  1. SPWeb site = siteCollection.RootWeb;
  2. site.Title += "interview";
  3. site.Update();

35) Can an event receiver be deployed through a SharePoint feature?

Yes.

36) What is a content type?

A content type is an information blueprint basically that can be re-used throughout a SharePoint environment for defining things like metadata and associated behaviors. It is basically an extension of a SharePoint list, however makes it portable for use throughout an instance regardless of where the instantiation occurs, ergo has location independence. Multiple content types can exist in one document library assuming that the appropriate document library settings are enabled. The content type will contain things like the metadata, listform pages, workflows, templates (if a document content type), and associated custom written functionality.

37) Can a content type have receivers associated with it?

Yes, a content type can have an event receiver associated with it, either inheriting from the SPListEventReciever base class for list level events, or inheriting from the SPItemEventReciever base class. Whenever the content type is instantiated, it will be subject to the event receivers that are associated with it.

38) What two files are typically (this is kept generally) included when developing a content type, and what is the purpose of each?

There is generally the main content type file that holds things like the content type ID, name, group, description, and version. There is also the ContentType.Fields file which contains the fields to include in the content type that has the ID, Type, Name, DisplayName, StaticName, Hidden, Required, and Sealed elements. They are related by the FieldRefs element in the main content type file.

39) What is an ancestral type and what does it have to do with content types?

An ancestral type is the base type that the content type is deriving from, such as Document (0x0101). The ancestral type will define the metadata fields that are included with the custom content type.

40) Can a list definition be derived from a custom content type?

Yes, a list definition can derive from a content type which can be seen in the schema.XML of the list definition in the element.

41) When creating a list definition, how can you create an instance of the list?

You can create a new instance of a list by creating an instance.XML file.

42) What is a Field Control?

Field controls are simple ASP.NET 2.0 server controls that provide the basic field functionality of SharePoint. They provide basic general functionality such as displaying or editing list data as it appears on SharePoint list pages.

43) What base class do custom Field Controls inherit from?

This varies. Generally, custom field controls inherit from the Microsoft.SharePoint.WebControls.BaseFieldControl namespace, but you can inherit from the default field controls.

44) What is a SharePoint site definition? What is ghosted (uncustomized) and unghosted (customized)?

SharePoint site definitions are the core set of functionality from which SharePoint site are built from, building from the SiteTemplates directory in the SharePoint 12 hive. Site definitions allow several sites to inherit from a core set of files on the file system, although appear to have unique pages, thereby increasing performance and allowing changes that happen to a site propagate to all sites that inherit from a site definition. Ghosted means that when SharePoint creates a new site it will reference the files in the related site definition upon site provisioning. Unghosted means that the site has been edited with an external editor, and therefore the customizations are instead stored in the database, breaking the inheritance of those files from the file system.

45) How does one deploy new SharePoint site definitions so that they are made aware to the SharePoint system?

The best way to deploy site definitions in the SharePoint 2007 framework is to use a SharePoint solution file, so that the new site definition is automatically populated to all WFE’s in the SharePoint farm.

Wednesday, February 13, 2008

Great file Archiving utility 7-Zip

I have started using 7-zip from http://www.7-zip.org/. Its a great utility for archiving and retrieving. I have replaced my windows zip with this util. Give it a try, you will like the speed and ease.

Win shell command for Time Resync

Here is a handy command I found to resync time to the nearest networked time server.
w32tm /resync
This is very usefull when your system time is off for any reason.