Wednesday, August 27, 2008

Problems with BDC Definition Editor

Here is a problem I found while preparing for my TechEd Presentation next week (Wednesday evening). I want to show how to use the "Microsoft ® Business Data Catalog Definition Editor" application that helps create BDC ADF files. It allows to connect to a SQL server or a web service, and generates the ADF file, with entities that you choose, and some methods, and then allows you to modify and test your methods. A nice tool all around, but incomplete if you ask me.
The first problem I had with it was when I tried to connect to the AdventureWorksLT database. The database looks like this:


What was the problem? The Definition Editor application connected to the database without any problems, and showed me the tables and views, but when I tried to drag and drop a table to the design surface, I got the following error: "Could not process Table 'Customer'.Make sure you have SELECT Rights on the Table/VIEW."


After searching the net, I have found that many people have seen it, and some have blogged about it, but there was no solution.
I found that if I drag some of the tables in the database - BuildVersion and ErrorLog tables, then it works.
What is different between those two tables and the rest? Well - those two tables are using the DBO schema, while the rest are using the SalesLT schema.
Yes - the BDC Definition Editor doesnt play with custom schemas. Not documented anywhere - so I might as well document it here. I loaded the AdventureWorksDW database, where it doesnt use a custom schema (and all the MSDN samples use for some reason) and what do you know? it works.

Problem 2: The BDC Definition Editor does not generate finder methods. This is very annoying! I mean, when we select a table to be an entity in the design surface, we have a choice to choose which field is the title field for that table, but the editor doesnt do anything with that selection - leaving it up to us to create the finder method that will allow the users to search for an entity by name instead of by ID. WHY???!

Problem 3: This isnt really a problem with the tool, but a problem with me, so here is a hint in case I forget this again - The wildcard character attribute appears when you click on the LOB system node itself. Not at the instance level.

After TechEd I will upload some of my demos here as videos. Interested?

AMD developer site on SharePoint

Just noticed this today (Thanks Bob Fox for pointing it out) - an amazing site done with SharePoint: AMD Developer site

Thursday, August 21, 2008

Ask me a question, win an HP iPAQ

Are you coming to TechEd Australia? Want to ask me a question about sharepoint? use this form, and you may win an iPAQ (they didn’t tell me which model).
Don't forget to nominate me as the person to answer the question.
Oh, you have to be logged in to the teched web site to be able to fill that.

Open letter to laptop manufacturers

Hello. My name is Ishai, and I am a professional developer, who also presents, teaches, and travels with his laptop.
I have requirements from my laptop that are different from home users or business users. Is there anyone out there willing to pick up the slack and build a laptop that would WORK and give me what I need?

Currently I am using a Dell XPS M1330 - which is a wonderful machine. But the manufacturer (to which I will refer as "Dell") will not support 64bit operating systems.
Thats right - I have a problem with the bluetooth on my laptop, and they won't support.So why build a laptop with a 64bit enabled CPU, sell it with 4GB RAM, and then expect your customers to install vista 32bit on it? or XP?
Bad Dell. Very bad.
Moving on - Why can't I get drivers for windows 2008? Why must I hack the nvidia drivers, the bluetooth drivers and still have a lot of things that don't work - just because no one would support a server OS on a laptop?
Where is the brave executive who will say "we make the best laptops for professionals, and we will prove it by supporting the newest operating systems, and provide drivers for everything"? Don't you want the kind of publicity when all presenters of every technical event (teched and such) show up to present with your laptops?

Here is what I expect for a professional laptop line:

  1. Newest Intel\AMD CPU
  2. Support for 4-8GB RAM (for multiple virtual machines)
  3. Screens in 13', 15' and 17' form factors
  4. The 13' model not to weigh more than 1.5kg, and slim
  5. Replacable batteries (for long flights)
  6. At least 4 USB outputs
  7. HDMI (dvi) and VGA outputs
  8. Wireless network (n) module built in
  9. Bluetooth module built in (A2DP)
  10. Option for Solid State Disk
  11. Option for raid of two disks in the larger models
  12. Decent grapics card (preferably not one that burns like the nvidia 8400)
  13. ESATA (or, in the near future USB3)
  14. SD card reader
  15. Full support for windows 2008 server (that includes a support centre helping with malfunctioning)
  16. No crapware installed (that includes the most rediculous "dell dock" - most useless piece of software ever developed by a hardware vendor)
That's it! how hard can it be?
Aperrantly very hard, since no one is offering anything like it...(and before the MAC addicts post here - show me a mac with esata, and tell me if apple supports you with win2008 problems, and do you like to hack drivers?)

Oh, and while I am at it - Nokia - is it too much to expect that your PC Suite will install on a server OS? I am giving you until the release of windows mobile 7 to explain why I can't synchronize my phone because I am using windows 2008...If I don't hear from you, HTC (or samsung) is going to get another sale.

Tuesday, August 19, 2008

My BDC presentation at Teched Australia

TechEd Australia is coming soon, and I have the only 400 level presentation in the Office System track. I will be presenting with American MVP Todd Bleeker, and we will be doing demo after demo after demo - lots!
If you are coming to TechEd and want to hear us talk, make your interest known on the teched site, so we will get a bigger room...

Creating Solutions with the Business Data Catalog
During this session, learn what the Business Data Catalog (BDC) is, why you would want to use it, and how to create applications that leverage the BDC. This session demonstrates what functionality the out-of-the-box BDC Web Parts provide and shows how they can be leveraged to quickly create applications inside SharePoint without writing a line of code! The session also demonstrates how custom Web Parts and Windows Forms Applications may be used to accesses BDC data when the out-of-the-box BDC Web Parts don't meet the needs of a project. Finally, this session demonstrates how to use the BDC and Excel Services KPIs to create powerful digital dashboards.

Infrastructure update kills view functionality in picture libraries

Oh, bugger!

Take a look at Brian Farnhills' blog's latest entry. He has just found that the infrastructure update released last month kills some functionality in picture libraries.

I wonder if that was intended.

http://pointstoshare.spaces.live.com/Blog/cns!AEC42F315B4528B0!2974.entry Update - I have opened a support request with Microsoft, and waiting for their response. Update - answer from Microsoft PSS - "known issue". They are checking to see if there is anyone working on a hot fix. By the way - Brian is presenting at today's Canberra SharePoint User Group meeting about site definitions. Should be interesting!

Grouping and sorting settings of custom fields

In my previous post, I wrote about how sharepoint checks if a field is groupable. One of the things the code there does is check if a field is sortable.

I had assumed that that meant that if a custom field has in it's schema "Sortable=False", then it would not show up in the "sort" and "group by" dropdowns in the edit and new view pages.

However, it turns out that if the custom field inherits from a field that is sortable (like the text field for example), then what you set in the schema gets ignored - and the field still returns "true" for .Sortable.

I have not found why that is, and the only workaround of how to make a custom field unsortable if it inherits from a text field is to change the code in ViewNew.aspx and ViewEdit.aspx pages to skip those field types.

Not nice.

Thursday, August 14, 2008

How sharepoint determines if a field is "groupable"

Here is one for anyone who ever wondered why a certain field is not showing up in the "Group By" selection box.

You know how you can define in the field definition if the field is "sortable" and "filterable"? Well, what about "groupable"? its not an option! But still, some fields don't show up in the dropdown for grouping in the view settings dialog. How is that set?
The answer is in the aspx file ViewNew.aspx (and ViewEdit.aspx) - these files have server side scripts that has a function "IsGroupable". This function checks if the field should be displayed in the list of fields that you can group by.
Here are the rules:

  1. If the fiels is not "sortable", then it is not groupable
  2. If the field is hidden, then it is not groupable
  3. If the field is set not to display in viewforms, then it is not groupable
  4. If the field is a lookup field and is set to display related items, then it is not groupable
  5. If the field is the built-in file name field, then it is not groupable.
From the list above you can see that it is pretty logical...except #3! Heck! A lot of times you dont want to display the field in views, but you still want to group by it!

So, here you go. If you were puzzled why your field was not showing up - now you know.

Here is the code

protected bool IsGroupable(SPField field)
{
 if (!field.Sortable ||
  !ShowField(field) ||
  ((field as SPFieldLookup) != null && (field as SPFieldLookup).CountRelated))
 {
  return false;
 }
 if (iBaseType == SPBaseType.DocumentLibrary
  && (field.InternalName == "FileLeafRef"
      || field.InternalName == "LinkFilenameNoMenu"
      || field.InternalName == "LinkFilename"
      || field.InternalName == "NameOrTitle"))
 {
  return false;
 }
 return true;
}

Monday, August 11, 2008

Goodbye good friend

A good friend, and an excelent sharepointer has passed away last weekend.
Lee Marriage was the sort of person who made everyone like him. He was always ready with a smile, and had an excelent approach to managing people - one that I always envied.
I worked with Lee on several SharePoint projects, and on each one I was in awe at how fast he learned new stuff, how he got the customer to listen to his advice and how he got the people working for him to work in a relaxed, yet efficient manner. I liked his style so much, I recommended and voted for him for employee of the year for last year in our company UniqueWorld
Lee had a sharepoint blog, "The learning curve" which wasn't very active, but the posts he did have were informative. He co-managed the Sydney SharePoint user group, and we were hoping to recommend him to an MVP status soon.

Lee passed away while running the City to Surf fun run from a heart attack. I don't understand how that could be, since Lee was a very fit (not to mention young - 27).I played soccer with him once and was astounded at his skills.
Lee will be missed by his girlfriend, his friends, his collegues in UniqueWorld, the Sydney user group members, and I think the entire sharepoint world has suffered a terrible loss.

Good bye my friend.

Tuesday, August 05, 2008

Why no posts?

If you were wondering why I didn't post lately (almost a month now), there are several reasons. Basically, I am just too busy...
I am writing a book (about SharePoint, but I can't give any details about it yet...stay tuned)
I am preparing for a TechEd Australia presentation on BDC
I am waiting to hear from TechEd Europe if they want me to present one of 11 presentations I sent to them and are on the waiting list, and I also have a private life (believe it or not). so...sorry, but posts are low right now.

Do not read from the SharePoint Database (unless you absolutely know what you are doing)

Other developers always ask me this, and it is a very common question in the forums. Many people argue that there is no danger in read only access. So for future referance, here is the Microsoft article that describes the issue, and an extract from it. (My thanks to Shane Young who sent me the link lately and reminded me where is was).

"customers are strongly advised against direct access in a read-only manner to these databases unless Microsoft protocol documentation is followed exactly. Accessing these databases programmatically or manually could cause unexpected locking within Microsoft SQL Server that can result in overall performance problems."

What accounts does the people picker show

I was asked this the other day - "In a user field, what determines what accounts are displayed to the user?" Well, ofcourse that depends on some factors such as what authentication provider you are using, but if you are using the default (window active directory) provider, then the LDAP query that defines what users are returned is embedded in the field control.

I took a look (reflected) the control and found the query that is being ran.

That was easy enough - the trick is understanding this long query....From my minimal understanding it is looking only for people or groups (depending on the setup of the field) and only those that are enabled in active directory (userAccountControl=2) where the name or display name or email address or account name or SIP address starts with the text the user entered.

Here you are - from the inside of the DLL:

"(&(objectCategory=person)(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(|(name={0}*)(displayName={0}*)(cn={0}*)(mail={0}*)(sn={0}*)(SamAccountName={1}*)(proxyAddresses=SMTP:{0})(proxyAddresses=sip:{0}){2}))", "(&(objectCategory=person)(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(|(name={0})(displayName={0})(cn={0})(mail={0})(samAccountName={0})(proxyAddresses=SMTP:{0})(proxyAddresses=sip:{0})))", "(&(objectCategory=person)(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(|(mail={0})(proxyAddresses=SMTP:{0})))"), new SearchParameter("(&(objectCategory=group)(|(name={0}*)(displayname={0}*)(cn={0}*)(SamAccountName={1}*)(mail={0}*)(proxyAddresses=SMTP:{0}){2}))", "(&(objectCategory=group)(|(name={0})(displayname={0})(SamAccountName={0})(mail={0})(proxyAddresses=SMTP:{0})))", "(&(objectCategory=group)(|(mail={0})(cn={0})(proxyAddresses=SMTP:{0})))"), new SearchParameter("(&(objectCategory=group)(groupType:1.2.840.113556.1.4.803:=2147483648)(|(name={0}*)(displayname={0}*)(cn={0}*)(SamAccountName={1}*){2}))", "(&(objectCategory=group)(groupType:1.2.840.113556.1.4.803:=2147483648)(|(name={0})(displayName={0})(cn={0})(samAccountName={0})))",