SharePoint 2010 – Resources

It has been a while since I blogged, I got held up with an important movements in my Life. And back to the topic , recently Microsoft had a public talk in its SharePoint Conference 2009 about the product Microsoft SharePoint 2010, that has created so much of expectation in the field. Unlike MOSS 2007 this release of SharePoint has lots of information right from the day one. I just wanted to share with you the following links that will help you to get started

Prior to the conference Jeff had a three part article posted in the SharePoint Team Blog that gave a complete history of SharePoint, its definitely a must read articles to understand how SharePoint has reached a state of how it is now.

You need to go through the items in the same order as Listed.

 

At last I am going to upgrade my Desktop to 64 bit, so I will share my experience about the process in the following blog posts.

New Release

Yes, on eighteenth October of two thousand nine, my wife and me blessed with a baby girl. We had named her Diya. Last two weeks was very though as they both had few complication after birth, and by god grace it all went well now. So not to mention now I have an added responsibility.Definitely it is a different feeling to be a dad. Here is how she looks.

diya

Diya I know some day you will read this Post and I wanted to let you know that as always I  love you so much.

Join Two Array – Zipping

Last week I had a requirement where I need to Join two array,there was no relation that I could use to  join LINQ.

Int32[] iArrayOne = {12,34,45,89};

String[] sArrayTwo= { “Value1”,”value2”,”value3”,”Value4”}

Later which I posted a question in SO,in fact it was not possible directly in LINQ.Eric has written a Post that solves my requirement. Yes the operation is termed as Zipping. Until .NET 4.0 we need to use the below snippet to achieve it and starting 4.0 we will have that function as part of the .NET.

public static IEnumerable<TResult> Zip<TFirst, TSecond, TResult>
(this IEnumerable<TFirst> first,
IEnumerable<TSecond> second,
Func<TFirst, TSecond, TResult> resultSelector)
{
if (first == null) throw new ArgumentNullException("first");
if (second == null) throw new ArgumentNullException("second");
if (resultSelector == null) throw new ArgumentNullException("resultSelector");
return ZipIterator(first, second, resultSelector);
}

private static IEnumerable<TResult> ZipIterator<TFirst, TSecond, TResult>
(IEnumerable<TFirst> first,
IEnumerable<TSecond> second,
Func<TFirst, TSecond, TResult> resultSelector)
{
using (IEnumerator<TFirst> e1 = first.GetEnumerator())
using (IEnumerator<TSecond> e2 = second.GetEnumerator())
while (e1.MoveNext() && e2.MoveNext())
yield return resultSelector(e1.Current, e2.Current);
}
Zipping operation is defined as 
var qry = from row in iArrayOne.Zip(sArrayTwo, (temp1, temp2) => 
new { ArrayObject1 = temp1, ArrayObject2 = temp2 })
Tags : ,

SharePoint Getting Started

Few weeks back I saw a question in the Stackoverflow. The question was How to start learning SharePoint. Well at first it seem simple, I couldn't get an answer straight away. I did a Google but no luck all links I landed up was about some SharePoint books. The user who posted the question specifically mentioned that he doesn't want go through books to get the hold of it. Well I am of the same kind I hate going through 500+ pages books. Finally I answer the question on how I learnt SharePoint. Below is my answer for the question.

First step is to get created with a SharePoint site, from your System admin.

If you are the one who need to kick start the SharePoint. Then follow the steps and for each of the steps you can find ample number of links using Google

  1. Install SharePoint and Configure it.
  2. Create a Site Collection
  3. Go to the Site and in the Right Corner you will find a Menu called Site Settings
  4. Select that and play around with each and every options out there.
  5. Most of the options can be understood by the Name
  6. If you struck up some where come to SO or Start over again.
  7. Make sure that you always ask the question why this behaves this way & why this implemented this way.
  8. Try creating pages Same Site Settings Menu has option to create page.
  9. There is some thing called Web Part which is actually a Pluggable component UI/ functionally which can be customized as per the user needs.
  10. Try using those web parts (Lost of Out of the Box)
  11. Later move in to Web Part development,create your own, deploy it
  12. Start using the Microsoft.SharePoint.dll to access the SharePoint site using you custom code.

To give you a brief description.

Microsoft Office SharePoint Server 2007 is an integrated suite of server capabilities that can help improve organizational effectiveness by providing comprehensive content management and enterprise search, accelerating shared business processes, and facilitating information-sharing across boundaries for better business insight. Additionally, this collaboration and content management server provides IT professionals and developers with the platform and tools they need for server administration, application extensibility, and interoperability.

  1. I call it as Application development platform
  2. For anything you wanted to do there will be a option directly / indirectly in SharePoint
  3. Basically it is a Web Application built on top of ASP.NET 2.0
  4. Main entry point to it is an Web Application (Central Administration Site) you get this once you install SharePoint.
  5. This is where you can Create Web Application (Nothing but a Site in the IIS & Content DB)
  6. Yes you read it right Database,SharePoint stores all its content in Database
  7. Web Application is directly not usable (Its like empty DB and Empty IIS site) you need to have some content to be display to the user.
  8. Then Site collection comes, it give content to the User.You need to at least create Site collection under Web Application (Through Central Admin).
  9. While Creating Site Collection you will be provided with a Site Template (Template is nothing but a Blue print sort of thing that will dictate what your site will look like and what it have) there are template For Project Management,Bug Tracking (has options to track Bug, kind of basic infrastructure that will be needed in any Bug Tracking system).
  10. Next level is Sub site, under site collection you can have Site( here too you have an option to select the template), and under that Site you can have another Sub Site so on.
  11. And there is another important thing in SharePoint called List, its a similar to Table in SQL server but not exactly same (because list content are internally stored in SQL Tables), and List contains Fields (Similar to Column in Table). You can use them to store your custom data. While creating the list also you will have Templates (Say for example to Represent a Announcement you have a template, this will have all the fields that are needed to represent announcement)
  12. And you have a Option to Create your own List Structure as well.
  13. There is a special kind of List in SharePoint called Document Library which can store documents.
  14. One final thing Security, managing Security is out of the Box. You can control who has access to you Site and what they can Access (Only Announcement , only Published documents) and what they can do with the item (Edit/Read-only/Delete) etc.
  15. You can create fine grained permission as you wish.

Welcome to THE SHAREPOINT WORLD

.NET 4.0 – Part 1

You should be aware that .Net 4.0 is currently in CTP and I am currently in process of exploring the new features in .Net 4.0. Channel9 have a good series of videos that will help you to get started. This is where I started my journey towards .Net 4.0. I would like to share all the learning I had from the above videos and additions to that I would like to share few items that I noticed during my learning. Altogether you will find information about .Net 4.0, ASP.NET Visual Studio 2010. How well it integrates with SharePoint & more. To practice this you will need a CTP version of Visual Studio 2010 and .Net FX 4.0. You can download it from this location. Also be sure to follow these steps before you open the Visual Studio 2010 because it comes with a hardcoded value of 1 Jan 09 as expire date.

[Update: June 21,2009 : .Net 4.0 and Visual Studio 2010 Beta 1 is now available, please refer to the post for more information.]

This article will host Table of Links for the all Upcoming posts.

ASP.NET 4.0
ClientID (this)
EnableViewStage & ViewStateMode(Refering Dino's Post)
C# 4.0
Named and Optional Parameters
Visual Studio 2010
Snippets option for ASP.NET and HTML code 

One feature that has everyone's attention when it comes to ASP.NET 4.0 is ClientID. Till now we had the ClientID as the getter and renders the id based on the naming container, from 4.0 we will be able to decide how the client ID is render to the browser. Each of the server control in the ASP.NET 4.0 has three new Properties that decide how the client Id is rendered.

  1. ClientID                 -    ID that we wish to give to the server control when rendered to                                               the browser.
  2. ClientIDMode        -    Mode that decides how the client ID is generated.Can            anyone of the following value
  • Inherit         -    Gets the mode that is set to the parent.
  • Predictable    -    Gives us an option to predict the ClientID that is goingto get rendered. (In the case of data bound control it generates a auto increment number
  • Legacy        -    No change works as like the previous version and thisis the default value.
  • Static        -    Static value that we set will render as it is.

      3. RowClientIDSuffix    -    Sometimes when we use the Predictable option for ClientIDMode we might need to have a different pattern of the value as the suffix rather than having auto increment. In such a case we can provide a Comma Separated Value of Data Fields (Off course this option is available for the data bound controls) so the client Id will have the value of the Data field appended to the suffix.

Let's see an Example of the above. I have a User Control (ClientIDUserControl.ascx) with a Label inside that, which is used in the page. You can see my project structure in the screen shot.

ClientIDMode:: Legacy : In the below picture you will see the even though I set the client ID of the Label control it renders client ID based on the naming container, because by default the ClientIDMode is Legacy, I didn't specified the ClientIDMode attribute so it defaults to Legacy.

ClientIDMode:: Static : In the below picture you will see that both the client ID and ClientIDMode (Static) is set hence the client ID that is rendered to the client is same as the one we set in the Code.

ClientIDMode:: Inherit : In the below picture you will see that client id that was rendered is based on the Naming container because for the Label I set the ClientIDMode as Inherit. Because of this label check its parent (in this case it's the User Control) for the ClientIDMode and as it doesn't have one it goes to the Page and checks for the ClientIDMode, as page as well doesn't have one, it further goes to the web config and check for the ClientIDMode and as it doesn't have one it by defaults to the Legacy mode. You can also set the ClientIDMode property at the page or the WebApplication level.Refer to the notes section at the end of the article.

ClientIDMode:: Predictable : In the below picture you will see that ClientIDMode is set to Predictable and ClientID is set to "deleteEmployee" and as a result it renders the client id as a AutoIncremented value "DeleteEmployee_0" and soon. When setting the Predictable make sure that Parent control also has the ClientIDMode value set. Refer notes section in the end of the article.

ClientIDMode:Predictable and RowClientIDSuffix:

    When using the Predicatble option there is another tweak we can perform that is to generate our own predictable ID rather than using the auto incremented value of (0,1,2 …).In the below picture I have used RowClientIDSuffix to ID and Company, hence the rendered element has the ID in the format DeleteEmployee_[ID]_[Company]

Notes:

  1. While using the ClientIDMode="Predictable" you need to set the ClientIDMode property in the parent control as well else the ClientID generated by the client control will not have the predictable value, it will default to Naming container method of generating the ID. In the above case I have set the ClientIDMode of the GridView to Static and the CheckBox which is the child control to Predictable.
  2. In addition to the setting the ClientIDMode to the each and every control you can set this value at the Page Level or at the Application level (Web.Config).When there is no explicitly set ClientIDMode to any of the control it will get the value from the page or Web.Config level if one is set else it default to the legacy mode. 
Mode ID ClientID Suffix Client ID At the Browser
Legacy/Nothing Set A C - [ParentNamingContanierID]_A
Static A C - C
Predictable A C - C_0,C_1
Predictable A C ID C_[ID],C_[IDNext]

A control with the specified ID could not be found within the scope of the current naming container : SPGridView – SPMenuField

Lately I was working on the SPGridView provided by SharePoint.One of the requirement I had was to have a column in SPGridView as a Menu one that is similar to ECB of the List items, it  was straight forward, refer to the Paul article for the example, though the example was targeted towards building Webpart and controls were created programmatically, converting it to work with UserControl is not a big deal, Visual Studio Intellisense will help you and Property names are pretty straight forward.

While I was adding a SPMenuField there were couple of Properties of SPMenuField that drawn my attention.

To help you understand the issue better I have given the screen shot of my code {bear with me As I don't have a tool that will format the code with color, I have given it as a screenshot,so that it will be easy to understand}

HiddenMenuItemIdsFields

From the name of the property it is clear that it will help us to define which menu item that needs to be Hidden. So I jumped in to and gave the Id of one of the MenuItemTemplate I wanted to disable in my case MenuItemTemplate1, result System.InvalidOperationException: Field not found: MenuItemTemplate1

                SPMenuTemplate 

                From the exception I got, it was pretty clear that it is expecting a Field from the DataSource, List in our case. So Next thing I tried was to put a Field in the List, instead of the Id of the MenuItemTemplate, and now I got System.ArgumentException: A control with the specified ID could not be found within the scope of the current naming container: XYZ, this time It gave me different exception. I ran through net and didn't find any thing that gave a right approach. Finally after going through the Reflector and  with the Value of XYZ in the Exception Message I got the actual meaning of it.

                It means that HiddenMenuItemIdsFields expects a field from the list, whose  value corresponds to the MenuItemTemplate that needs to be hidden.

                And if this confuses you refer the below diagram.

                 

                SPMenuTemplate1

                 

                I have two column in the List “Title,MenuItemValueToDisable” the trick is in MenuItemValueToDisable field. We need to set the value For HiddenMenuItemIdsField=”MenuItemValueToDisable” and the value in the Field should have an Id of the MenuItemTemplate. As in the example I have two value respective to the each of the MenuItemTemplate I have defined so for the first row I will not have the “Details” menu option and for the second More Details menu option will be disabled.

                Same rule applies for the following fields as well

            • DisabledMenuItemIdsFields - (Not only the Single field you can give more than one fields separated by comma)
            • CheckedMenuItemIdsFields (I didn't know how to use it – If someone has used it please let me know I can I utilize it)(Not only the Single field you can give more than one fields separated by comma)
            • MenuTemplateIdField  - One one Field is accepted here.
            The fields you have specified for any of the above property should have a valid value, in case if it has value.If it is empty there will not be any error, control will render all the menus.

Promoting Properties – Expose InfoPath Fields as Site Columns

Well First Let me explain what does it mean by Promotion and Demotion

  • Promotion    -    It means that you capture the value present in the document (*.xml or wordML or you can   write your own document parser) and expose it to the SharePoint document library as a Column. What you get out of it is that you have a synchronization of the Data between the document and Column of the doc library. (When you update the document it gets automatically reflected in the document library and vise versa.) 
  • Demotion        -    It means the opposite. You capture the column of the Document Library and display it in the Document.    

Well whenever you publish a InfoPath form to the SharePoint server using File->Publish, at the end of the Wizard you will be provided

with a Option that will allow you to the add the field of the InfoPath to the document. How can do that when I automation the publishing of the InfoPath using features or When I publish the form using Central Administration Website?. There is an option in InfoPath, where you can specify the fields to be promoted to the Document Library at the design time. Use Tools->Form Option -> Property Promotion


Deploying InfoPath forms Using Features – the Right Way

A week back couple of my friends was asking is there a proper way to deploy the InfoPath forms to the server, Way other than File -> Publish - > SharePoint server with or without forms server. I did a quick search and was not lucky, came to a lackadaisical conclusion that there is no other way. But whenever I deploy workflows with InfoPath form I see a new solution that adds itself to the Solution Store. By this I know for sure there is some other way to deploy InfoPath forms. First thing want I wanted was to get the

Solution out of SharePoint and see what's there inside, Again for this there is a tool through which you can do it [I lost the url from where I got it] or hardly 10 lines of code is all what you need.

To my surprise there is indeed a way to do it, well let's see how. What I got out of that solution is a feature, what's in it [Image speaks louder than words, image with comments even louder ;) ] ]

Feature.xml

Element.xml

################### You are Right its again another File Provisioning in to SharePoint Lib #####################

############# Be sure to put the location as FormServerTemplates############

Here is the Stripped Out Version of the XML.



Steps in Short:

  • Develop your IP form.
  • Publish it to the network location as how you do to upload to the Central Administration Upload Form Templates.
  • Create one Feature.xml, Element.xml as defined in the article [Sorry how workflow does ;)].
  • Put in the IP form and create a feature out of it.
  • Its all. 

THE LAUNCH !!!

It all started three+ years back a point of time when I was nurtured enough to find the information I wanted through Internet search, be it technical or general some way or the other I land up in a blog. Specifically that time SharePoint 2007 was in beta and there was very limited information over internet on the subject, As I saw most of the blog from the SharePoint Product team I was in a perception that blogs are meant to them, Later which I came to know about Blogspot which allows you to have your personal blog, I started one, but as there were so much to learn in SharePoint and have to spent all of my time in R & D to get the things working for my First ever Web CMS site based on SharePoint 2007, which was almost ready when the SharePoint RTM came out. I didn't find time to update my blog. Another thing I hate about blog is the Editor I didn't like the editor provided by the Blogspot as it is so small and was not able to type the content with ease. I didn't know about the tools (Word 2007 / Live writer ) that will help you to do that with ease. Later I got inspired with Wordpress for the rich set of tool it provide and the full screen functionality, which is when I started this.I was kind of used to update the blog at least twice a month.

As I started more blogging, I saw some pain points.Wordpress is pretty good at what they do and one limitation I was so concerned with the Wordpress/Blogspot is that I don't have more control on the template and the layout.I wanted to have more control on the website layout. I wanted to have more space for my content and it should be presentable to the user who is reading it. Soon I decided to have a blog for my own. I wanted it to be flexible enough I ran through couple of options, upgrade my Wordpress account, but it wont allow me to change the layout even If I upgrade, also Wordpress is running on PHP, I wanted my blog to running in something from Microsoft stack, ASP.NET. I was impressed by the theme used by Reza but then it was based on PHP Wordpress. I finally know what my blog should look like but I didn't know how to search for that template. Later I came across Tim site and it was running on ASP.NET. I mailed him and got the information that he uses Subtext Project as the blog engine. I then found that the theme used by Reza was inove from Wordpress. Last weekend I spent whole time to get the theme applied in the Subtext. Next item was to chose a good provider and buy a host name. Lot of options, I was looking at everydns for getting a host name for free and net4 to host my site, but everydns didn't work for some reason and net4 site is itself slow, It didn't look good. Finally I got all under ZnetIndia, customer support is so cool and got complete thing wired with in 1 Hour. I had to setup the subtext with IIS 7 as you need to configure the App Pool to run in  the Integrated Classic more else you will end up in httpModule issue.

And after all this here is what it looks like. Thanks for reading it through so far and I would like to have a comment if you have one on my blog. I will be happy to share this site theme, if you want  just leave me a comment. Also I have planned to concentrate only on SharePoint SharePoint SharePoint and bit of .NET & ASP.NET.