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})))",

Sunday, July 13, 2008

Updating web part properties, without the tool pane

here is a nice developer article for you - something I see asked a lot of times, and Rob Nowik is answering with a great how to article: Updating web part properties, without the tool pane

Wednesday, July 02, 2008

CAML sorting by file name

If you are doing a CAML query and want the results sorted by the file name (and not by title, which may be different than the file name) use the following:
<OrderBy><FieldRef Name='LinkFilenameNoMenu' /></OrderBy>