All posts by Ayman El-Hattab [MVP]

Ayman El-Hattab is a Technology Evangelist @ Nintex & a recognized industry expert focusing on helping organizations plan, design, develop, build, govern and operate enterprise collaboration solutions. You can follow Ayman on Twitter @AymanElHattab to stay updated on his upcoming activities.

Speaking at Egypt SharePoint User Group on June 16th With Michael Noel

I would like to announce that I’ll be speaking at Egypt SharePoint User Group on June, 16th with Michael Noel.

The event will be held at ITWorx Egypt Roof Cafeteria, Nasr City – Free Zone.

Here is the event agenda :

6:30PM – 6:45 PM start
6:45 PM – 7:45 PM Building the Perfect SharePoint Farm: A Walkthrough of Best Practices from the Field

7:45 PM – 8:00 PM Break
8:00 PM – 9:00 PM Deep Dive Into SharePoint Content Types
9:00 PM – 9:30 PM Open Discussion

Michael Noel

Building the Perfect SharePoint Farm: A Walkthrough of Best Practices from the Field

SharePoint 2007 has proven to be a technology that is remarkably easy to get running out of the box. On the flipside, however, some of the advanced configuration options with SharePoint are notoriously difficult to setup and configure, and a great deal of confusion exists regarding SharePoint best practice design, deployment, disaster recovery, and maintenance. This session covers best practices encompassing the most commonly asked questions regarding SharePoint infrastructure and design, and includes a broad range of critical but often overlooked items to consider when architecting a SharePoint environment. In short, all of the specifics required to build the ‘perfect’ SharePoint farm are presented through discussion of real-world SharePoint designs of all sizes.

Learn from previous real world deployments and avoid common mistakes.
Plan a checklist for architecture of SharePoint environments of any size.
Incorporate High Availability, Disaster Recovery, and Virtualization into an existing SharePoint environment.

Michael Noel is an internationally recognized technology expert, bestselling author, and well known public speaker on a broad range of IT topics. He has authored several major best-selling industry books that have been translated into over a dozen languages. Significant titles include SharePoint 2007 Unleashed, Teach Yourself SharePoint 2007 in 10 Minutes, Windows Server 2008 Unleashed, ISA Server 2006 Unleashed, Exchange Server 2007 Unleashed, and many more. Currently a partner at Convergent Computing (www.cco.com) in the San Francisco Bay Area, Michael’s writings and extensive public speaking experience across six continents leverage his real-world expertise helping organizations realize business value from Information Technology infrastructure.

Ayman El-Hattab

Deep Dive Into SharePoint Content Types 

Content types are incredibly cool and fundamental to how SharePoint works with Data and Information. In this session we’ll explore the power of custom content types development and see how we can use them for customizing the visual appearance, introducing new behaviors and much MORE !

Note: due to limited seats you have to register and present the registeration mail at the event.

Active at MSDN and TECHNET Forums ( Seeking the Third Star )

Hello All,
Just wanted to inform you that I’ll be active ( Hopefully ) in the next period @ MSDN and TECHNET Forums, I’ve been awarded a star a couple of months ago and I’m seeking the third one.
Here is a list of my prvious threads : http://social.technet.microsoft.com/Forums/en-US/user/threads?user=Ayman%20El-Hattab .
And here is a link to my profile there : http://social.technet.microsoft.com/Profile/en-US/?user=Ayman%20El-Hattab.

5

Join me there if you need to ask me or any of the experts there any questions , I’ll be waiting for you @ SharePoint : Development And Programming Forum.

Upgrade SQL Express to Standard or Enterprise for MOSS 2007

Microsoft so very graciously provides a free version of SQL 2005, SQL Express, with MOSS. If you install MOSS using the Basic option or Single Server under Advanced you get SQL Express automatically. So what if as a budding newbie SharePoint admin you chose the Basic option, but now as a wise aged SharePoint admin you’ve seen the error of your ways and want to use a more respectable version of SQL for your SharePoint backend? You’re in luck. This blog post will walk you through upgrading SQL Express to SQL Standard or Enterprise.

SharePoint Branding messed up in IE8

Here is another question that I answered @ MSDN Forums :

Q : We just tested our sharepoint branding in IE8, but it’s totally messed up!what’s wrong with IE8 ??Did anybody encounter this before ?

A : Generally, there are two choices for rendering mode, “standards” mode and “quirks” mode. In “standards” mode, a modern browser will do its best to render the document according to the W3C recommendations, even if it leads to unexpected results.
In “quirks” mode, a modern browser will try to handle an (x)HTML document like older browsers from the mid-to late ’90s did. It will do its best to imitate the parsing, rendering, and bugs of earlier browsers when encountering sloppy or invalid code authoring. And, it will display those quirky pages in the same way as those earlier browsers do.
So how does a browser decide whether it should use “standards” mode or “quirks” mode? Why, by examining the doctype, or lack thereof on the web page.
IE8 decides its rendering engine based on DocType in the master page:
If IE8 sees a valid DocType declared it will attempt to render a site in IE8 Standards Mode.
If IE8 does not see a DocType it will attempt to render a site in quirks mode
Master pages like default.master that do not have a doctype declared will render automatically in IE8 in quirks mode.
However if you create a custom master page and add a doctype IE8 will try to render the page in IE8 standards mode which will cause some problems like in showing SharePoint dynamic menus .
So if you want to add a DocType, you should add the followint Meta Tag < meta equiv=”X-UA-Compatible” content=”IE=EmulateIE7″> , this will render your page like IE7 Mode.

Feedback on the Arabic web casts!

Last week, I have been receiving wonderful feedback on the Arabic SharePoint web casts I have recorded lately, I would like to thank everybody who took time to send me an e-mail or contacted me via facebook or twitter to give me his/her feedback.

I would like also to extend a special thank you to Mike Walsh [SharePoint MVP and author of Sams Teach Yourself SharePoint 2007 in 24 Hours: Using Windows SharePoint Services 3.0] for giving my webcasts a plug in his blog.

38

ReadOnly, Hidden and Sealed Fields

That’s another question that I Answered in MSDN Social forums and thought of sharing with you here 🙂
Q :
The documentation regarding those attributes is not informative enough.
Hidden :
Optional Boolean . If TRUE , the field is completely hidden from the user interface. Setting ReadOnly to TRUE means the field is not displayed in New or Edit forms but can still be included in views.
ReadOnly :
Optional Boolean . If TRUE , the field is not displayed in New or Edit forms but can be included in views. Setting the Hidden attribute to TRUE completely hides the field from the UI.
Anybody knows the differences ?And what about CanToggleHidden attribute ?

A :

Similarities : Both aren’t displayed anywhere unless you configure a view to show any of them.
Differences : Hidden Fields can be updated through the object model but ReadOnly fields can’t be updated through OM like “Created” And “Created By” fields.

If you are still confused, consider the following example :You have a field that you use only by the object model for setting or getting a flag and you don’t want the field to be visible to anybody and non updatable through the UI, however you want it to be updatable through the object model.
For me, I was creating a list that stores the applications of Scholarships offered by a foundation and we needed the status of each application to be totally hidden but updatable through the OM.
Theoritically, this should be an east task :
SPSite site=SPContext.Current.Site;
SPWeb web=site.OpenWeb();
SPList list =web.Lists[“ScholarshipApplicationsList”];
string id=list.Fields.Add(“Status”,SPFieldType.Boolean,false);
SPField statusField = list.Fields.GetField(id);
statusField.Hidden=true;
statusField.Update();

But if you try this you’ll receive a nice exception
Why? The Hidden property checks if CanToggleHidden property is true and throws an exception if its not.
Fair enough, all we do then is set the CanToggleHidden property to true and do the update but there is no such a property in the object model.
So I’ve decided to use “Reflection” ..
SPField statusField= web.Lists[“ScholarshipApplicationsList”].Fields[“Status”];
Type type = spfield.GetType();
MethodInfo mi = type.GetMethod(”SetFieldBoolValue”,
BindingFlags.NonPublic BindingFlags.Instance);
mi.Invoke(spfield, new object[] { “CanToggleHidden”, true });
statusField.Hidden = true;
statusField.Update();
And if you want to use CAML, this is much more easier :
<field displayname=”Status” type=”Boolean” required=”FALSE” name=”NewField” cantogglehidden=”TRUE” hidden=”TRUE”>

Q :
Thanks Ayman El-Hattab.I’ve created a few hidden fields but now I’m trying to delete them using the following code :
list.Fields[“Status”].Delete();
But I’m gettin the following exception :
“You cannot delete a hidden column ”

A :
Unhide the field , then delete it. CanToggleHidden attribute is now set to true, so you can hide and unhide the field as you wish.

Lovely 12 Hive :)

A couple of hours ago, while surfing the MSDN Forums and I experienced a very interesting Question, well, let’s me share with you here the Question and my answer.

Q : We are creating a custom field type in a multilingual publishing site, we need to use the DisplayPattern to render the field value plus other Data that is language specific? Any ideas ?

A : Again , “The 12 hive is our teacher”.You know the little “New!” Icon that is displayed beside an Item when it’s newly created ?I’ve once created an Arabic/English site and I found out that the image is rendered in Arabic in the Arabic context and in English in the English Context which is great. Then you can definetly do that too either by Code or by CAML.
Let’s see if we can achieve that by means of CAML.
Open the 12 hive, Templates, Featues and open the folder of the fields feature, then open fieldswss.xml.
check the field titled “LinkTitleNoMenu” and let’s have a look at its display pattern.I’ve copied a part of it here, what I care about is the undlerlined part of the CAML below ..

<DisplayPattern>
<IfEqual>
<Expr1><LookupColumn Name=”FSObjType”/></Expr1>
<Expr2>1</Expr2>
<Then><Field Name=”LinkFilenameNoMenu”/></Then>
<Else>
<HTML><![CDATA[<a onfocus=”OnLink(this)” href=”]]></HTML><URL/>
<HTML><![CDATA[” ONCLICK=”GoToLink(this);return false;” target=”_self”>]]>
</HTML>
<Column HTMLEncode=’TRUE’ Name=”Title” Default=’$Resources:core,NoTitle;’>
</Column>
<HTML><![CDATA[</a>]]></HTML>
<IfNew>
<HTML><![CDATA[<IMG SRC=”/_layouts/[%=System.Threading.Thread.CurrentThread.CurrentUICulture.LCID%]/images/new.gif” alt=”]]></HTML>
<HTML>$Resources:core,new_gif_alttext</HTML>
<HTML><![CDATA[“>]]></HTML>
</IfNew>
</Else>
</IfEqual>
</DisplayPattern>

Got it ?You can write server-side code inside your display pattern :0 TERRIFIC
By the way I just discovered that when trying to answer your question but a little humble piece of advice to you is ” Love your 12 hive, Check out the OOB features, 12 Hive can really teach us a lot of cool stuff related to the UX

That was my answer and I’m waiting for him/her to mark it as answered LOL!
see you

Microsoft Innovation Day, Steve Ballmer Key note speaker

Microsoft Egypt is organizing Microsoft innovation day 22 April 2009 where all the Egyptian Online and Offline communities will gather and deliver some technical sessions and of course one of the communities is Egypt SharePoint Users Group.
Me and Marwan Tarek ( MOSS MVP) will be representing Egypt SharePoint Users Group and Marwan will be presenting “jQuery and SharePoint”.
Steve Ballmer will be the key note speaker for the innovation day and he will answer the Users groups questions about Microsoft strategy.

Hey SharePoint, please do not to handle that exception for me, I’ll take care of it!

It’s a good practice to catch the UnauthorizedAccessException within your sharepoint code , it might be thrown if the logged in user does not have enought permissions to get some code execued in his security context .
However, the SharePoint platform handles this exception on the developer’s behalf by redirecting to _layouts/AccessDenied.aspx page .
To override this behavior, you can set the property SPSecurity.CatchAccessDeniedException to false, telling SharePoint “Please do not to handle the exception for me, I’ll take care of it“.

Example :
bool AccessDeniedflag = SPSecurity.CatchAccessDeniedException;
SPSecurity.CatchAccessDeniedException = false;
try
{
SPList list = web.GetList(web.ServerRelativeUrl+”/Lists/ListName”);
SPListItem item = list.Items[0];
item[“title”] = “ayman-elhattab.blogspot.com”;
item.Update();
}
catch(UnauthorizedAccessException ex)
{
// Redirect to your custom page
SPUtility.Redirect(“MyAccessDeniedPage.aspx”,SPRedirectFlags.RelativeToLayoutsPage,this.Context);
}
finally
{
SPSecurity.CatchAccessDeniedException = AccessDeniedflag;
}