Sunday, July 30, 2006

MOSS - Adding a 'Save site as template' Link to Site Settings

Quick post - go read Adding a 'Save site as template' Link to Site Settings in WSS v3/MOSS 2007 using a CustomAction Feature and read how to actually do it.

Thank you Tony Bierman!

Tuesday, July 25, 2006

New stuff in web parts for sharepoint developers

Some of you may be wondering why I have not posted in a couple of days. Well, there was the weekend, and then I started working on a set of two web parts that I want to publish here. I will keep them as a surprise, but I promise they will be open source if you promise not to send it to the http://thedailywtf.com!

Meanwhile, I will tell you about a couple of things I discovered while working on these web parts:

  1. I wanted to create two web parts in one DLL. This seems to be an easy task - exactly like making one web part - just add another class, inherit from "webpart" and make sure its has the same namespace and make sure that you register it as safe. Sounds easy right? Well - I managed to waste two days trying to make this work (and this should go to http://thedailywtf.com) because I didnt notice that the second class I added didnt have the "public" declaration (this is the default for a new class in visual studio). So I tried and tried and tried, and finally the good MVP Daniel Larson helped me find the small mistake.
  2. This is something new for developers - fields in lists now have new properties in the object model :
    1. ShowInDisplayForm
    2. ShowInEditForm
    3. ShowInListSettings
    4. ShowInNewForm
    5. ShowInVersionHistory
    6. ShowInViewForms
    I can see we are going to have so much fun with these properties! So many people who want today to show fields in the version history screen will be delighted to know this, as well as people who want to edit the forms but are reluctant to use frontpage (and with reason!) To bad these properties are only accessible through code. Adding these to the UI would have been great! I have not had the time as yet to actually use them (I just noticed them in passing) but I do hope they work like they sound (the msdn has "todo" in the documentation of these features)
  3. While we are at it - another nice addition to the field object "GetFieldValueForEdit". I dont know yet what it does, but I have my suspicions!
  4. Ahhh, this is a great one- "FieldRenderingControl". Again, no documentation and I had no time, but I think this is going to be a huge time saver for all of us developers who need sometimes to write alternative input forms for lists. Just think about it - the field contains the information of which control to use. I will have to check tomorrow how it works exactly with the default field types since it returns a "sharepoint webcontrol" and not a regular "web.ui control". I will update. (save me some time if you know - post a comment!)

So now you know that my secret web part has something to do with fields...I wont tell you ny more so I wont ruin the surprise!

Wednesday, July 19, 2006

Great new search solution for WSS 2

I know I usually write about wss3 and sharepoint 2007, but this product just got released by KwizCom that I thought all my readers should be aware of.

The product is "WSS Cross Site Search" and it allows you to search in WSS as if you had portal (across sites, advanced search and more) and for cheap (current pricing stands on 560$)!

Now, I have seen some other products that do similar items, but what I liked about this one, is that it completely integrates into the wss framework. Take a look:

And check out the advanced search page:

I also like the sound of some of the items in the feature list:
  • Easy management of properties available for the advanced search
  • User can define that the search results page will be displayed on a new window
  • Clicking an Office 2003 document (Word, Excel, PPT) in the search results page opens it in Edit mode
  • Available both as a web part and as a custom control, enabling easy deployment both in WSS sites and WSS site definitions

How good is that???

I hope you find it as useful as I do. The guys from KwizCom did it again.

Link to the product page

kick it on SharePointKicks.com

Monday, July 17, 2006

Modifying the WSS3 tree navigation control

I wanted to create a structure of sites and allow easy navigation between them. Sharepoint 2007 (or rather, WSS3) has a fantastic tree view of the site hierarchy that you can activate if you want through the site administration page.

One of the grate things about the tree view is that it expands on the server side. This means that the page wont suffer from bad performance even if the site tree is large (unless there are a lot of sites directly underneath it and not in a hierarchy).

I will explain in this article how to tweak some features of this control.

Step 1 - Turn on the tree-view navigation:

  1. Open the site you want to display the tree in
  2. Open the "site actions" dropdown and select site settings
  3. From the site actions, under "Look and Feel" click "Navigation Options"
  4. Tick the "Enable Tree View" box to show the tree view. Notice that you also have an option to disable quick launch, but that is for another article.
  5. Go back to the home page in your site:

So far, so good.

Now - my problem was that I wanted the users to see only the sites and not the document libraries. As you can see - the tree view by default is showing everything (my sites were blank sites so they didnt have any lists, but I want them to have lists and not to display them) including the "Form Templates" library in the top level site!

Step 2 - Modify the Control in the Master Page

  1. Open the site in frontpage.
  2. In the folder list, expand the "_catalogs" folder and then the "masterpage" folder and find the "default.master" page and open it.
  3. I prefer to work in split view - that way I can get to where I want in the code much faster. Just click on the tree control in the bottom pane, and the code pane at the top will jump to the code section of the tree.
  4. Find the piece of code that says ">SharePoint:sphierarchydatasourcecontrol<" as shown below:
  5. Modify the code- under "IncludeDiscussionFolders" add a new line and write (frontpage offers intellisense so it will help you write it) the code that says not to show document libraries, lists and folders:
  6. Save the file and exit sharepoint designer.

End Result

You can see that now the navigation shows a tree of only sites. You also learned how to show only document libraries, or only lists and so on. (note - there is a way to tell it not to show sub webs...can you figure it out yourself?)

Hope you enjoyed this. More to come!

if you liked this tip, help it by kicking it!
kick it on SharePointKicks.com

[Update: 27/04/2007]
I have been asked by people "why can we not see the treeview after enabling it". Well, the answer is simple - the tree view control isn't in the master page for the page you are looking at. You will need to either change the master page itself, or set a different master page for the page.

What Video Game Character am I?

At the risk of being accused that I have too much time on my hands, I will post the result of this short personality test I just did, and found out that if I was a Video Game Charecter I would be....:

What Video Game Character Are You? I am a Gauntlet Adventurer.A Gauntlet Adventurer.

I strive to improve my living conditions by hoarding gold, food, and sometimes keys and potions. I love adventure, fighting, and particularly winning - especially when there's a prize at stake. I occasionally get lost inside buildings and can't find the exit. I need food badly. What Video Game Character Are You?

I think this describes me pretty well.

Sunday, July 16, 2006

At last - BDC file manager.

All hail Todd Baginski!

I have been debating with myself if to post something about the business data catalouge for some time now.
I just did'nt want to look like a fool who cant understand how to make it work. But it seems I was not alone. The sharepoint community was pretty silent about the BDC and I couldnt find anyone explaining it better than the SDK. Slowly I became desperate and thought the BDC is going to be another IBF (if you dont know - be glad).

And to the rescue comes Todd Baginski, who wrote a magical application (ok, I didnt test it yet, but I trust the Todd) to create the BDC file for us.
I suggest we all download it and save it quick before he decides to charge us for the usage (hehehe)

here is the link to the article where Todd explains the application and how it works, and here is the link to the download page.

All hail Todd Baginski!

Possible bug in workflow schema?

I am playing around with workflows, and I have stumbled on what is either a possible bug or a mistake in documentation.

The SDK clearly states that "Microsoft Windows SharePoint Services (version 3) supports absolute or server-relative paths in the workflow template definition. All form path URLs must be expressed in one of these formats. For example, an absolute path, such as "http://site/library/page.aspx"; or a server-relative path, such as "/layouts/page.aspx". Microsoft Windows SharePoint Services (version 3) does not support link fix-up in workflow template definitions."

So from this I understand that a link like "http://sharepoint/_layouts/formserver/.../form.aspx" is as valid as "/layouts/formserver/.../form.aspx".

Well, either I misunderstood, or the documentation is wrong or there is a bug. I tried the full absolute URL ("http://sharepoint...") and when I set the workflow settings for a forms library, it tried to open the link as if it was relative ("http://sharepoint/http://sharepoint...").

I can only hope this is a minor bug, and microsoft are planning to fix this.

Side Note
By the way, am I the only one who, when he writes fast on the keyboard writes "sharepoing" instead of "sharepoint"? I guess its because my fingers are used to writing "ping" and also because I am used to an agronomic keyboard, and I dont have one here at work. )-:

Thursday, July 13, 2006

Virtual PC is free!

Ok, so this isnt a SharePoint article. But its big enough for everyone to shout:
Microsoft have just made virtual PC free and available to download.
They Also announce that the next version (2007) that will support vista and virtualization will also be free.

Now, everyone say "thank you microsoft!".

Monday, July 10, 2006

Best practices for editing master pages

I saw Shane's article about Customizing Master Pages using SharePoint Designer 2007, where he warns about frontpage changing the referances automatically, and I thought I should write some best practices as I find them (will be updated in the future).

Best practices:

  1. Only change a master page after you backed it up.
  2. If you are changing a master page in a site and not the global one, don't back up using frontpage copy and rename (see Shane's article). Instead, download the master page to your computer and save it in a folder with a note to what site it belongs to.
  3. Back up the entire "12" directory before you do anything on a sharepoint server local files. To make my self clear, I am talking about "c:/program files/common files/microsoft shared/web server extensions/12" folder.
  4. Editing master pages in frontpage (aka sharepoint designer) is not recommended (by me) since it tries to update the links to the controls, and then you get in trouble. What fronpage does is remove the "~" character before the link to the controls in the ">%@ Register" section at the top of the page. If you must edit the file using frontpage, you should open it again in notepad and add the "~" charecter in the register tag, before the "/_controltemplates" link. An easy way to do it, is open the file in notepad, and do a search for "/_controltemplates and replace with "~/_controltemplates

Again I'd like to stress that these 4 rules are just the begining. We will have a lot more, so keep in touch - I will update when I learn more.

If you liked this article, please kick it!
kick it on SharePointKicks.com

Sunday, July 09, 2006

FAQ - how to force documents to open in their own application and not IE

Now, here is a FAQ if I ever heard one! (this post is more for me - because every time I am questioned about this, I say that I remember there was a solution, but I have to research for it every time)

Almost every one I help implement sharepoint asks me how to make sure that when his users click a link to a document it will open in word and not in IE. Same for excel and powerpoint.

Well, The good news are that in MOSS 2007 its easy - just go to a document library's advanced settings and you will see that the default it to "open in the client application".

Now, this is great, but still we have two more problems:

  1. What about links to documents that are not in a document library
  2. What about sharepoint 2003?

The answer is easy. The settings on how to open a document can be changed on the client side. The article in the technet (http://support.microsoft.com/?scid=kb;en-us;162059) shows how to change the client machine preferance on how to deal with each application.

Hope this saved you some research... if it did, please kick it on SharePointKicks.com

Wednesday, July 05, 2006

Saving a site as template

Update (31/07/2006) - Tony Bierman writes on how to add the link to the site settings using a feature.

I dont know if I missed something, but I searched and searched and the link to save a sub site as template just wasnt there!

I finally decided on a "bugger all" solution - I went to the top level site, where the link "save site as template" is in the site settings and clicked it.
I noted that the page that starts the save proccess is under "/_layouts/savetemplate.aspx".
I went back to the site I was trying to save as template, and just added the "/_layouts/savetemplate.aspx" to the url (example: http://my server/sitedirectory/teamsite1/teamsite2/_layouts/savetemplate.aspx)

To make a long story short - this works just fine. I wonder if microsoft just forgot this link (I couldnt find documentation to it in the known issues list)
Liked it? kick it!
kick it on SharePointKicks.com

New in this blog - a blog roll!

I have just registered to BlogRolling.com and created my sharepoint blog roll. This is a list of blogs I regularily visit, and I want to share them with you guys.

You can see the blog roll on the right hand side of this page, on the bottom. There is also a RSS link so you can set your rss reader to tell you when I find a new blog or sharepoint site. Hope you like it!

Tuesday, July 04, 2006

Found it! How to Add Properties To advanced Search in MOSS 2007

Amazing!!!
Microsoft went with a design that I actually planned to do in sps2003 and never got around to do. The settings for the advanced search are now in the web part it self and not in the properties. This allows for flexibility in a much bigger scale.

For this demo I have added a custom property called "branch" to the profile properties, and in the following walkthrough I will show how to add searching on that property to the advanced search screen of the people search.

Step 1 - Add a custom property to the profile database:


I find it neccesary to explain this, since the location for this was changed from sps2003.
To manage the properties in the profile database today, you need to go, not into the sharepoint portal site settings (where it used to be in the 2003 version) but into "sharepoint centeral administration" (from administrative tools) and there click the shared service link on the left. The profile management links are all there.
For the purpose of this demo I created a property called branch, of type "string" with "choice list" and added some options to the list. I hope tommorrow I will have time to post some images to make this explanation easier to understand.

Step 2 - change the advanced search:


Open the search page you want to edit the advanced search for (in this demo I used the people search page) and use the "Site Actions">"Edit page" menu to edit the page:

Open the menu for the search web part and select "Modify shared web part" to open the web part property pane:

Expand the "Miscellaneous" section in the properties pane and find the property called "properties":

Now, this is the nice part. This property contains an XML string that allows you to define what properties will be displayed in the advanced search. I advise you copy the string into an xml editor for better editing, or even just notepad.

Edit the XML string and save it back into the property. I added a line (last line in the following example, marked in green) to add the branch property I created, and the end result looks like this:

<Properties>
<Property Name="Department" ManagedName="Department" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:Department"/>
<Property Name="JobTitle" ManagedName="JobTitle" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:Title"/>
<Property Name="Responsibility" ManagedName="Responsibility" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-Responsibility"/>
<Property Name="Skills" ManagedName="Skills" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-Skills"/>
<Property Name="QuickLinks" ManagedName="QuickLinks" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:QuickLinks"/>
<Property Name="Branch" ManagedName="Branch" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:Branch"/>
</Properties>

After saving the property to the web part, publish the page, exit edit mode and switch to advanced search:

Notice how sharepoint sees that the branch property is a choice list property and automatically lets the user select from the list?

Liked it? please kick me: kick it on SharePointKicks.com

User Profiles In Sharepoint 2007

One of the most annoying things in sharepoint 2003 was the limited functionality with user profiles. You had a limited amount of types of fields, and a limited control over who can change what.

Sharepoint 2007 gives better control and more types of fields. It is still dissapointing to see that some things are missing - when we are talking about people details the need for master-detail lists usualy comes up (if the person is from this department, he can only be from one of these teams).

Even so, user profiles do offer more customizability.

One of the exciting new things is the ability to add choice fields to the profile. These choice fields can let users pick information to describe themselves from a list of choices.

The field can be either Closed (The user must select from a predefined list of values only) or Open (the user can either select from a predefined list or enter his own text) and can be Multivalued (the user can select several values).

An example to such a list is the "Skills" list. You can populate the list of skills in your organization, and then every user can select the skills that he has from the list. Then, users in the portal can search for people with specific skills!

Another field type is the person field (like in the lists) - allowing the user to select from the list of users.

I am still researching on how to expose fields to the advanced search. Currently the advanced people search shows only certain fields, but I know everyone wants to search on different fields. The only option I found that is related to this is to select if the field is indexed or not, but that doesnt add the field to the search interface. If anyone knows how to do that - let me know!